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", "featureFlags", newTestEnvironmentsModalController]);
27 function newTestEnvironmentsModalController($uibModalInstance, $uibModal, AaiService, TestEnvironmentsService, OwningEntityService, $log, $scope, _, COMPONENT, $rootScope, featureFlags ) {
29 vm.newEnvironment = {};
30 vm.releaseVersions = {};
32 var init = function () {
33 vm.newEnvironment.operationalEnvironmentType = "VNF";
34 loadCategoryParameters();
35 loadEcompEnvironmentsList();
38 var loadEcompEnvironmentsList = function () {
39 TestEnvironmentsService.loadAAIestEnvironments("ECOMP")
40 .then(function(response) {
41 vm.environments = response.operationalEnvironment;
43 .catch(function (error) {
44 vm.aaiConnectError = error.message;
49 var loadCategoryParameters = function () {
50 OwningEntityService.getOwningEntityProperties(function(response){
51 vm.environmentsTypesList = response["operational-environment-type"].map(function (environmentType){
52 return environmentType.name;});
53 vm.workloadContextList = response["workload-context"].map(function (context){
54 return context.name;});
55 vm.releaseVersions = response["release"].map(function (releaseOptions){
56 return releaseOptions.name;});
57 },COMPONENT.TENANT_ISOLATION_FAMILY);
61 vm.setEcompEnvironment = function (selectedIndex) {
62 var ecompEnvironment = vm.environments[selectedIndex];
63 vm.newEnvironment.ecompInstanceId = ecompEnvironment.operationalEnvironmentId;
64 vm.newEnvironment.ecompInstanceName = ecompEnvironment.operationalEnvironmentName;
65 vm.newEnvironment.tenantContext = ecompEnvironment.tenantContext;
68 vm.close = function () {
69 $uibModalInstance.close();
72 vm.createEnvironment = function () {
73 if($scope.newTestEnvironment.$valid) {
74 var requestDetails = vm.newEnvironment;
75 delete vm.newEnvironment['release'];
76 $rootScope.$broadcast(COMPONENT.MSO_CREATE_ENVIRONMENT, {
77 url : COMPONENT.OPERATIONAL_ENVIRONMENT_CREATE,
78 requestDetails : requestDetails
84 vm.isShowReleaseEnabled = function () {
85 return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_1908_RELEASE_TENANT_ISOLATION);