2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 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=========================================================
24 appDS2.controller("newTestEnvironmentModalController", ["$uibModalInstance", "$uibModal", "AaiService", "TestEnvironmentsService","OwningEntityService",
25 "$log", "$scope", "_", "COMPONENT","$rootScope", newTestEnvironmentsModalController]);
27 function newTestEnvironmentsModalController($uibModalInstance, $uibModal, AaiService, TestEnvironmentsService,OwningEntityService, $log, $scope, _, COMPONENT, $rootScope) {
29 vm.newEnvironment = {};
31 var init = function () {
32 vm.newEnvironment.operationalEnvironmentType = "VNF";
33 loadCategoryParameters();
34 loadEcompEnvironmentsList();
37 var loadEcompEnvironmentsList = function () {
38 TestEnvironmentsService.loadAAIestEnvironments("ECOMP")
39 .then(function(response) {
40 vm.environments = response.operationalEnvironment;
42 .catch(function (error) {
43 vm.aaiConnectError = error.message;
48 var loadCategoryParameters = function () {
49 OwningEntityService.getOwningEntityProperties(function(response){
50 vm.environmentsTypesList = response["operational-environment-type"].map(function (x){
52 vm.workloadContextList = response["workload-context"].map(function (x){
54 },COMPONENT.TENANT_ISOLATION_FAMILY);
58 vm.setEcompEnvironment = function (selectedIndex) {
59 var ecompEnvironment = vm.environments[selectedIndex];
60 vm.newEnvironment.ecompInstanceId = ecompEnvironment.operationalEnvironmentId;
61 vm.newEnvironment.ecompInstanceName = ecompEnvironment.operationalEnvironmentName;
62 vm.newEnvironment.tenantContext = ecompEnvironment.tenantContext;
65 vm.close = function () {
66 $uibModalInstance.close();
69 vm.createEnvironment = function () {
70 if($scope.newTestEnvironment.$valid) {
71 vm.newEnvironment.workloadContext = vm.newEnvironment.operationalEnvironmentType + '_' + vm.newEnvironment.workloadContext;
72 var requestDetails = vm.newEnvironment;
73 $rootScope.$broadcast(COMPONENT.MSO_CREATE_ENVIRONMENT, {
74 url : COMPONENT.OPERATIONAL_ENVIRONMENT_CREATE,
75 requestDetails : requestDetails