2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
22 * The Instantiation (or View/Edit) Controller controls the instantiation/removal of
23 * deployable objects (Services, VNFs, VF-Modules, Networks, and Volume-Groups)
28 appDS2.controller("AddNetworkNodeController", ["COMPONENT", "FIELD", "PARAMETER", "DataService", "CreationService", "$scope", "$window", "$location",
29 function (COMPONENT, FIELD, PARAMETER, DataService, CreationService, $scope, $window, $location) {
31 $scope.serviceMetadataFields = [];
32 $scope.tenantList = [];
33 $scope.nodeTemplateFields = {};
35 $scope.regexInstanceName = /^([a-z])+([0-9a-z\-_\.]*)$/i;
36 $scope.errorMsg = FIELD.ERROR.INSTANCE_NAME_VALIDATE;
38 var handleGetParametersResponse = function(parameters) {
39 $scope.serviceMetadataFields = parameters.summaryList;
40 $scope.tenantList = DataService.getCloudRegionTenantList();
42 if(DataService.getPortMirroningConfigFields()){
43 $scope.nodeTemplateFields =DataService.getPortMirroningConfigFields();
45 $scope.nodeTemplateFields = angular.copy(_.keyBy(parameters.userProvidedList, 'id'));
48 $scope.modelName = DataService.getModelInfo(COMPONENT.VNF).modelCustomizationName;
51 CreationService.initializeComponent(COMPONENT.VNF);
53 CreationService.getParameters(handleGetParametersResponse);
55 $scope.setTenant = function(field) {
56 $scope.nodeTemplateFields.tenant.optionList = _.filter($scope.tenantList, {'cloudRegionId': field.value, 'isPermitted': true});
59 $scope.cancel = function() {
60 $window.history.back();
63 $scope.next = function() {
64 // DataService.setLcpRegion($scope.nodeTemplateFields.lcpRegion.value);
65 // DataService.setModelInstanceName($scope.nodeTemplateFields.instanceName.value);
66 // DataService.setTenant($scope.nodeTemplateFields.tenant.value);
67 // var suppressRollback = ($scope.nodeTemplateFields.suppressRollback.value) ? true : false;
68 // DataService.setSuppressRollback(suppressRollback);
69 DataService.setPortMirroningConfigFields($scope.nodeTemplateFields);
70 $location.path("/serviceProxyConfig");
73 $scope.$on('$routeChangeStart', function (event, next, current) {
74 if(next.$$route.originalPath !=="/serviceProxyConfig"){
75 DataService.setPortMirroningConfigFields(null);