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=========================================================
23 var editMSModelController = function ($scope, $modalInstance, message, $http, PapUrlService, UserInfoService, Notification){
24 if(message.microServiceModelsDictionaryData==null)
25 $scope.label='Add Micro Service Model'
27 $scope.label='Edit Micro Service Model'
28 $scope.disableCd=true;
32 PapUrlService.getPapUrl().then(function(data) {
34 papUrl = config.PAP_URL;
39 /*getting user info from session*/
41 UserInfoService.getFunctionalMenuStaticDetailSession()
42 .then(function (response) {
43 loginId = response.userid;
46 $scope.editMSmodelName = message.microServiceModelsDictionaryData;
48 $scope.uploadFile = function(files) {
49 var fd = new FormData();
50 fd.append("file", files[0]);
51 $http.post(papUrl + "/ecomp/ms_dictionary/set_MSModelData.htm", fd, {
52 withCredentials: false,
53 headers: {'Content-Type': undefined },
54 transformRequest: angular.identity
55 }).success().error( );
59 $scope.saveMSModel = function(microServiceModelsDictionaryData) {
60 var uuu = papUrl + "/ecomp/ms_dictionary/save_model.htm";
61 var postData={microServiceModelsDictionaryData: microServiceModelsDictionaryData, loginId: loginId};
66 contentType: 'application/json',
67 data: JSON.stringify(postData),
68 success : function(data){
69 $scope.$apply(function(){
70 $scope.microServiceModelsDictionaryDatas=data.microServiceModelsDictionaryDatas;});
71 if($scope.microServiceModelsDictionaryDatas == "Duplicate"){
72 Notification.error("MS Models Dictionary exists with Same Model Name.")
74 console.log($scope.microServiceModelsDictionaryDatas);
75 $modalInstance.close({microServiceModelsDictionaryDatas:$scope.microServiceModelsDictionaryDatas});
78 error : function(data){
79 alert("Error while saving.");
84 $scope.close = function() {
85 $modalInstance.close();