2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
34 function($scope, $rootScope, $uibModalInstance, data, svnservice, fileUpload,
36 console.log("//////ImportSchemaCtrl");
37 $rootScope.serviceInfo;
38 $rootScope.serviceInput;
39 $rootScope.serviceOutput;
40 $rootScope.serviceFault;
41 $rootScope.serviceInputPartInfo;
42 $rootScope.schemElemant1;
43 $rootScope.updateServiceInfo;
44 $rootScope.updateServiceInput;
45 $rootScope.updateServiceOutput;
46 $rootScope.updateServiceFault;
47 $rootScope.updateServiceInputPartInfo;
48 $rootScope.updateSchemElemant1;
49 // Below code is added to get the policyNames
50 var policies = getOperationalPolicyProperty();
51 for ( var obj in policies) {
52 if (!($.isEmptyObject(obj))) {
53 allPolicies = jQuery.extend({}, obj);
54 $scope.policyNames = [];
55 for ( var policy in allPolicies) {
56 $scope.policyNames.push(policy);
60 setTimeout(function() {
61 console.log("setTimeout");
64 $scope.close = function() {
66 $uibModalInstance.close("closed");
69 $scope.importSchema = function() {
70 console.log("importSchema");
71 isImportSchema = true;
72 var file = $rootScope.file_path;
73 // alert("file:"+schemaFile);
74 // console.log('file is ' + JSON.stringify(file));
75 var userID = document.getElementById("userID").value;
76 var password = document.getElementById("password").value;
77 var svnURL = document.getElementById("schemaLocation").value;
78 var schemaLocation = document.getElementById("schemaLocation").value;
79 if (schemaLocation && userID && password
80 && document.getElementById("schemaLocation").disabled == false) {
81 $scope.schemaLocation = schemaLocation;
82 $scope.userID = userID;
83 $scope.password = password;
84 document.getElementById("fileUpload").disabled = true;
85 var svnUploadURL = "/utm-service/schema_upload/svnUploadWSDL";
87 .SVNToUrl(schemaLocation, userID, password, svnURL, svnUploadURL)
91 document.getElementById('Upgrade Schema Version').classList
93 document.getElementById('Set Default Values').classList
95 $rootScope.wsdlInfo = angular.fromJson(pars);
96 $rootScope.serviceInfo = $rootScope.wsdlInfo.serviceInfo;
97 serviceName = $rootScope.serviceInfo.service.name;
98 $rootScope.schemaLocation = $rootScope.wsdlInfo.schemaLocation;
99 $rootScope.serviceInput = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage;
100 $rootScope.serviceInputPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage.partInfo;
101 $rootScope.serviceOutput = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage;
102 $rootScope.serviceOutputPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage.partInfo;
103 $rootScope.servicefault = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage;
104 $rootScope.servicefaultPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage.partInfo;
105 // alert("serviceInputPartInfo :: " +
106 // JSON.stringify($rootScope.serviceInputPartInfo));
107 $rootScope.inputSchemaServiceInputPartInfo = [];
108 $rootScope.inputSchemaServiceOutputPartInfo = [];
109 $rootScope.inputSchemaServicefaultPartInfo = [];
110 angular.copy($rootScope.serviceInputPartInfo,
111 $rootScope.inputSchemaServiceInputPartInfo);
112 angular.copy($rootScope.serviceOutputPartInfo,
113 $rootScope.inputSchemaServiceOutputPartInfo);
114 angular.copy($rootScope.servicefaultPartInfo,
115 $rootScope.inputSchemaServicefaultPartInfo);
116 $rootScope.isModel = true;
119 // alert("File upload failed and parameters not returned");
122 var uploadUrl = "/utm-service/schema_upload/uploadWSDL";
124 .uploadFileToUrl(file, uploadUrl)
128 document.getElementById('Upgrade Schema Version').classList
130 document.getElementById('Set Default Values').classList
132 // document.getElementById('Define/Modify
133 // Schema').classList.remove('ThisLink');
134 $rootScope.wsdlInfo = angular.fromJson(pars);
135 $rootScope.serviceInfo = $rootScope.wsdlInfo.serviceInfo;
136 serviceName = $rootScope.serviceInfo.service.name;
137 $rootScope.serviceInput = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage;
138 $rootScope.serviceInputPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage.partInfo;
139 // alert("Input Part Info :: " +
140 // JSON.stringify($rootScope.serviceInputPartInfo));
141 // alert("Input Part 1 Info :: " +
142 // JSON.stringify($rootScope.serviceInputPartInfo[1]));
143 // alert("Input Element :: " +
144 // JSON.stringify($rootScope.serviceInputPartInfo[1].schemaElements[1].elements[0]));
145 $rootScope.serviceOutput = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage;
146 $rootScope.serviceOutputPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage.partInfo;
147 $rootScope.servicefault = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage;
148 $rootScope.servicefaultPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage.partInfo;
149 // alert("servicefaultPartInfo :: " +
150 // JSON.stringify($rootScope.servicefaultPartInfo));
151 $rootScope.inputSchemaServiceInputPartInfo = [];
152 $rootScope.inputSchemaServiceOutputPartInfo = [];
153 $rootScope.inputSchemaServicefaultPartInfo = [];
154 angular.copy($rootScope.serviceInputPartInfo,
155 $rootScope.inputSchemaServiceInputPartInfo);
156 angular.copy($rootScope.serviceOutputPartInfo,
157 $rootScope.inputSchemaServiceOutputPartInfo);
158 angular.copy($rootScope.servicefaultPartInfo,
159 $rootScope.inputSchemaServicefaultPartInfo);
160 $rootScope.isModel = true;
165 $uibModalInstance.close("closed");
167 $scope.setFile = function(element) {
168 console.log("setFile");
169 $scope.$apply(function($scope) {
170 console.log("apply");
171 $scope.theFile = element.files[0];
172 $rootScope.fileName = $scope.theFile.name;
173 var file = element.files[0];
174 $rootScope.file_path = file;
175 // $uibModalInstance.close("closed");
176 angular.element(document.getElementById('fileUpload')).val(null);
179 $scope.setUpgradeFile = function(element) {
180 console.log("setUpgradeFile");
181 $scope.$apply(function($scope) {
182 console.log("apply");
183 $scope.theUpgradeFile = element.files[0];
184 $rootScope.upgradeFileName = $scope.theUpgradeFile.name;
185 // alert("fname1"+$rootScope.upgradeFileName);
186 var file = element.files[0];
187 $rootScope.file_path = file;
188 // $uibModalInstance.close("closed");
189 angular.element(document.getElementById('fileUpload')).val(null);
192 $scope.reset = function() {
193 console.log("reset");
194 document.getElementById("fileUpload").disabled = false;
195 document.getElementById("schemaLocation").disabled = false;
196 document.getElementById("userID").disabled = false;
197 document.getElementById("password").disabled = false;
198 document.getElementById("schemaLocation").value = '';
199 document.getElementById("userID").value = '';
200 document.getElementById("password").value = '';
201 $scope.theFile = null;
202 angular.element(document.getElementById('fileUpload')).val(null);
204 $scope.upgradeSchema = function() {
205 console.log("upgradeSchema");
206 // alert("inside upgrade schema");
207 var file = $rootScope.file_path;
208 // alert("file:"+schemaFile);
209 // console.log('file is ' + JSON.stringify(file));
210 var userID = document.getElementById("userID").value;
211 var password = document.getElementById("password").value;
212 var schemaLocation = document.getElementById("upgradeSchemaLocation").value;
213 var svnURL = document.getElementById("upgradeSchemaLocation").value;
214 console.log("after");
215 $rootScope.Currentmappedvalues = [];
216 if (schemaLocation && userID && password
217 && document.getElementById("upgradeSchemaLocation").disabled == false) {
218 $scope.schemaLocation = schemaLocation;
219 $scope.userID = userID;
220 $scope.password = password;
221 document.getElementById("fileUpload").disabled = true;
222 var svnUploadURL = "/utm-service/schema_upload/svnUploadWSDL";
224 .SVNToUrl(schemaLocation, userID, password, svnURL, svnUploadURL)
228 $rootScope.updateWsdlInfo = angular.fromJson(pars);
229 $rootScope.updateServiceInfo = $rootScope.updateWsdlInfo.serviceInfo;
230 $rootScope.schemaLocation = $rootScope.updateWsdlInfo.schemaLocation;
231 $rootScope.updateServiceInput = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage;
232 $rootScope.updateServiceInputPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage.partInfo;
233 $rootScope.updateServiceOutput = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage;
234 $rootScope.updateServiceOutputPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage.partInfo;
235 $rootScope.updateServicefault = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage;
236 $rootScope.updateServicefaultPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage.partInfo;
237 // alert("serviceInputPartInfo :: " +
238 // JSON.stringify($rootScope.serviceInputPartInfo));
239 // $rootScope.isModel = true;
242 // alert("File upload failed and parameters not returned");
245 var uploadUrl = "/utm-service/schema_upload/uploadWSDL";
247 .uploadFileToUrl(file, uploadUrl)
251 $rootScope.updateWsdlInfo = angular.fromJson(pars);
252 // alert("wsdlinfo:"+$rootScope.updateWsdlInfo);
253 $rootScope.updateServiceInfo = $rootScope.updateWsdlInfo.serviceInfo;
254 $rootScope.updateServiceInput = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage;
255 $rootScope.updateServiceInputPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage.partInfo;
256 $rootScope.updateServiceOutput = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage;
257 $rootScope.updateServiceOutputPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage.partInfo;
258 $rootScope.updateServicefault = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage;
259 $rootScope.updateServicefaultPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage.partInfo;
260 // alert("servicefaultPartInfo :: " +
261 // JSON.stringify($rootScope.servicefaultPartInfo));
262 // $rootScope.isModel = true;
267 $uibModalInstance.close("closed");
268 var dlg = dialogs.create(
269 'partials/portfolios/upgrade_schema_dtls.html', 'UpgradeSchemaCtrl',
274 windowClass : 'my-class'
276 dlg.result.then(function(name) {
277 console.log("dlg.result");
278 // $scope.name = name;
280 // if(angular.equals($scope.name,''))
281 // $scope.name = 'You did not enter in your name!';