diff options
author | Xue Gao <xg353y@intl.att.com> | 2019-03-19 14:03:35 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-03-19 14:03:35 +0000 |
commit | 5367feb3b33cdcd8af20180bec2ecd589cff82db (patch) | |
tree | 29f6a72f282a1b6fd78bdb0aff0bb21245e4afe3 /src | |
parent | 8d2cd45bf8d3d08b8213aa2b38847f1180eea6d3 (diff) | |
parent | e4aa522b862f9155d3b9271c2e3cb9ba97baec43 (diff) |
Merge "Remove useless UI code"
Diffstat (limited to 'src')
16 files changed, 152 insertions, 1449 deletions
diff --git a/src/main/resources/META-INF/resources/designer/css/app.css b/src/main/resources/META-INF/resources/designer/css/app.css index 34842ef5d..d9d7fd1ca 100644 --- a/src/main/resources/META-INF/resources/designer/css/app.css +++ b/src/main/resources/META-INF/resources/designer/css/app.css @@ -126,18 +126,6 @@ svg:not(:root) { z-index:100000; /*a number that's more than the modal box*/ } /* '' */ -.upgrade-schema:before{ - content: url('../images/UpgradeSchema.png'); - position:relative; /*or absolute*/ - z-index:100000; /*a number that's more than the modal box*/ - opacity:0.5; - cursor: none; -} /* '' */ -.upgradeSchema:before{ - content: url('../images/UpgradeSchema.png'); - position:relative; /*or absolute*/ - z-index:100000; /*a number that's more than the modal box*/ -} /* '' */ .set-default-values:before{ content: url('../images/SetDefaultValues.png'); position:relative; /*or absolute*/ diff --git a/src/main/resources/META-INF/resources/designer/index.html b/src/main/resources/META-INF/resources/designer/index.html index ec13e2a02..62672d213 100644 --- a/src/main/resources/META-INF/resources/designer/index.html +++ b/src/main/resources/META-INF/resources/designer/index.html @@ -34,7 +34,7 @@ <html lang="en" ng-app="clds-app"> <head> -<meta charset="utf-8"/> +<meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> @@ -47,7 +47,7 @@ <!-- bootstrap css and plugins --> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> - + <!-- DataTables CSS --> <link href="css/jquery.dataTables.css" rel="stylesheet"> @@ -73,16 +73,16 @@ <div ng-controller="dialogCtrl" style="display: none;"> <div class="row"> <div class="col-md-12"> - <button class="btn btn-danger" ng-click="launch('error')" style="display:none">Error - Dialog</button> - <button class="btn btn-primary" ng-click="launch('wait')" style="display:none">Wait - Dialog</button> - <button class="btn btn-primary" ng-click="launch('customwait')" style="display:none">"Custom" - Wait Dialog</button> - <button class="btn btn-default" ng-click="launch('notify')" style="display:none">Notify - Dialog</button> - <button class="btn btn-success" ng-click="launch('confirm')" style="display:none">Confirm - Dialog</button> + <button class="btn btn-danger" ng-click="launch('error')" + style="display: none">Error Dialog</button> + <button class="btn btn-primary" ng-click="launch('wait')" + style="display: none">Wait Dialog</button> + <button class="btn btn-primary" ng-click="launch('customwait')" + style="display: none">"Custom" Wait Dialog</button> + <button class="btn btn-default" ng-click="launch('notify')" + style="display: none">Notify Dialog</button> + <button class="btn btn-success" ng-click="launch('confirm')" + style="display: none">Confirm Dialog</button> </div> </div> </div> @@ -95,8 +95,8 @@ <!-- TOSCA Model Driven Dymamic UI Support --> <script src="lib/jsoneditor.js"></script> - <script src="lib/query-builder.standalone.js"></script> - + <script src="lib/query-builder.standalone.js"></script> + <script src="lib/angular.min.js"></script> <script src="lib/angular-cookies.min.js"></script> @@ -124,62 +124,44 @@ <script src="scripts/route_ctrl.js"></script> <script src="scripts/authcontroller.js"></script> <script src="scripts/query_params_handler_ctrl.js"></script> - - <script src="scripts/under_construction_ctrl.js"></script> - - + + <script src="scripts/under_construction_ctrl.js"></script> + + <script src="scripts/DashboardCtrl.js"></script> - <!-- File Upload start --> - <script src="scripts/FileUploadService.js"></script> - <script src="scripts/FileUploadCtrl.js"></script> - <!-- File Upload end --> - - - <!-- Export File start --> - <script src="scripts/ExportFileService.js"></script> - <script src="scripts/ExportFileCtrl.js"></script> - <!-- Export File end --> - - - <!-- Activity Modelling start --> <script src="scripts/ActivityModellingCtrl.js"></script> <!-- Activity Modelling end --> - + <!-- dialog box ctl start --> <script type="text/javascript" src="scripts/common_variables.js"></script> <!-- <script src="scripts/ImportProjectCtrl.js"></script> --> - <script src="scripts/CldsOpenModelCtrl.js"></script> - <script src="scripts/CldsModelService.js"></script> - - <script src="scripts/ImportSchemaCtrl.js"></script> - - <script src="scripts/importSchemaService.js"></script> - - <script src="scripts/UpgradeSchemaCtrl.js"></script> - - <script src="scripts/soapRequestService.js"></script> - - <script src="scripts/dataFactory.js"></script> - - <script src="scripts/textAreaCtrl.js"></script> - - <script src="scripts/userPreferencesService.js"></script> - - <script src="scripts/DeploymentCtrl.js"></script> - <script src="scripts/ExtraUserInfoCtrl.js"></script> - <script src="scripts/ExtraUserInfoService.js"></script> - <script src="scripts/saveConfirmationModalPopUpCtrl.js"></script> - <script src="scripts/GlobalPropertiesCtrl.js"></script> - <script src="scripts/AlertService.js"></script> - <script src="scripts/ToscaModelCtrl.js"></script> - <script src="scripts/ToscaModelService.js"></script> - - <!-- dialog box ctl end --> - <script src="scripts/aOnBoot.js"></script> - <script src="scripts/propertyController.js"></script> - <script src="scripts/menuHandler.js"></script> - -</body> + <script src="scripts/CldsOpenModelCtrl.js"></script> + <script src="scripts/CldsModelService.js"></script> + + <script src="scripts/OperationalPolicyCtrl.js"></script> + <script src="scripts/OperationalPolicyService.js"></script> + + <script src="scripts/dataFactory.js"></script> + + <script src="scripts/textAreaCtrl.js"></script> + + <script src="scripts/userPreferencesService.js"></script> + + <script src="scripts/DeploymentCtrl.js"></script> + <script src="scripts/ExtraUserInfoCtrl.js"></script> + <script src="scripts/ExtraUserInfoService.js"></script> + <script src="scripts/saveConfirmationModalPopUpCtrl.js"></script> + <script src="scripts/GlobalPropertiesCtrl.js"></script> + <script src="scripts/AlertService.js"></script> + <script src="scripts/ToscaModelCtrl.js"></script> + <script src="scripts/ToscaModelService.js"></script> + + <!-- dialog box ctl end --> + <script src="scripts/aOnBoot.js"></script> + <script src="scripts/propertyController.js"></script> + <script src="scripts/menuHandler.js"></script> + +</body>
\ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html index 6255698d8..203b3cd56 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html @@ -311,7 +311,6 @@ label { </div> <div attribute-test="policywindowpropertiesf" class="modal-footer"> - <!--<button ng-click="reset()" class="btn btn-primary" style="float:left">Reset</button>--> <button id="savePropsBtn" class="btn btn-primary">Close</button> <button ng-click="close(true)" id="close_button" class="btn btn-primary">Cancel</button> diff --git a/src/main/resources/META-INF/resources/designer/scripts/ActivityModellingCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/ActivityModellingCtrl.js index 97b26deee..7943f7239 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/ActivityModellingCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/ActivityModellingCtrl.js @@ -305,7 +305,7 @@ app.directive('expandable', function ($compile) { }); -app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','dialogs', '$filter','Datafactory','soapRequestService', function($scope,$rootScope, $location,dialogs,$filter,Datafactory,soapRequestService){ +app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','dialogs', '$filter','Datafactory', function($scope,$rootScope, $location,dialogs,$filter,Datafactory){ $scope.count=0; @@ -385,7 +385,7 @@ app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','di } }; - //Functionality for Hierarchical Elements + // Functionality for Hierarchical Elements $scope.addHierarchicalElement1 = function(schemaElement, parentElement, elementKey, index){ console.log("addHeirarchicalElement1"); if($rootScope.isHorR){ @@ -396,7 +396,8 @@ app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','di if($scope.clonedSchemaElement.repeatableHierarchicalPrefix == null) $scope.clonedSchemaElement.repeatableHierarchicalPrefix = ""; - //Remove any Heirarchical/Repeatable Elements in the ClonedSchemaElement + // Remove any Heirarchical/Repeatable Elements in the + // ClonedSchemaElement for(var i=0;i<schemaElement.type.elements.length;i++) { if(schemaElement.type.elements[i].element.name.indexOf(schemaElement.element.name) != -1) { $scope.clonedSchemaElement.type.elements.splice(i,(schemaElement.type.elements.length-i)); @@ -410,7 +411,7 @@ app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','di } - //Functionality for Hierarchical Elements + // Functionality for Hierarchical Elements $scope.addHierarchicalElement = function(schemaElement, parentElement, elementKey){ console.log("addHierarchicalElement"); $rootScope.isHorR = false; @@ -420,7 +421,8 @@ app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','di if($scope.clonedSchemaElement.repeatableHierarchicalPrefix == null) $scope.clonedSchemaElement.repeatableHierarchicalPrefix = ""; - //Remove any Heirarchical/Repeatable Elements in the ClonedSchemaElement + // Remove any Heirarchical/Repeatable Elements in the + // ClonedSchemaElement for(var i=0;i<schemaElement.type.elements.length;i++) { if(schemaElement.type.elements[i].element.name.indexOf(schemaElement.element.name) != -1) { $scope.clonedSchemaElement.type.elements.splice(i,(schemaElement.type.elements.length-i)); @@ -578,7 +580,8 @@ app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','di if($scope.clonedSchemaElement.repeatableHierarchicalPrefix == null) $scope.clonedSchemaElement.repeatableHierarchicalPrefix = ""; - //Remove any Heirarchical/Repeatable Elements in the ClonedSchemaElement + // Remove any Heirarchical/Repeatable Elements in the + // ClonedSchemaElement if(schemaElement.type.complexType != null){ for(var i=0;i<schemaElement.type.elements.length;i++) { if(schemaElement.type.elements[i].element.name.indexOf(schemaElement.element.name) != -1) { @@ -598,7 +601,8 @@ app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','di if(schemaElement.type.complexType != null){ for(var i=0;i<$scope.childElements.length;i++){ if(angular.equals($scope.childElements[i],schemaElement)){ - //console.log("Complex Element List Match :" +$scope.childElements[i]); + // console.log("Complex Element List Match :" + // +$scope.childElements[i]); $scope.childElements.splice((i+1),0,$scope.clonedSchemaElement); break; } @@ -606,7 +610,8 @@ app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','di } else if(schemaElement.element.name !=null) { for(var j=0;j<$scope.childElements.length;j++){ if(angular.equals($scope.childElements[j],schemaElement)){ - //console.log("Element List Match :" +$scope.childElements[j]); + // console.log("Element List Match :" + // +$scope.childElements[j]); $scope.childElements.splice((j+1),0,$scope.clonedSchemaElement); break; } @@ -671,7 +676,8 @@ app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','di if(schemaElement.type.complexType != null){ for(var i=0;i<$scope.childElements.length;i++){ if(angular.equals($scope.childElements[i],schemaElement)){ - //console.log("Complex Element List Match :" +$scope.childElements[i]); + // console.log("Complex Element List Match :" + // +$scope.childElements[i]); $scope.childElements.splice(i,1); $scope.index =i; break; @@ -680,7 +686,8 @@ app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','di } else if(schemaElement.element.name !=null) { for(var j=0;j<$scope.childElements.length;j++){ if(angular.equals($scope.childElements[j],schemaElement)){ - //console.log("Element List Match :" +$scope.childElements[j]); + // console.log("Element List Match :" + // +$scope.childElements[j]); $scope.childElements.splice(j,1); $scope.index= j; break; @@ -746,83 +753,6 @@ app.controller('ActivityModellingCtrl', ['$scope', '$rootScope', '$location','di } }; - - - - //Tst functions - - - //Generate and Download tst - $scope.generateTST = function(index){ - console.log("generateTST"); - Datafactory.setSelectedTestCase($rootScope.modeltestset.activityTestCases[index]); - - var tstInput={}; - console.log("inside generateTST() method"); - var generateTSTUrl ="/utm-service/soa_integration/generateTST"; - var tempActivityTestcase= {}; - angular.copy(Datafactory.getSelectedTestCase(),tempActivityTestcase); - - tstInput.activityTestCase = tempActivityTestcase; - - if(tstInput.activityTestCase.version != null){ - var newTestCaseName = tstInput.activityTestCase.testCaseName + "_"+ tstInput.activityTestCase.version; - tstInput.activityTestCase.testCaseName = newTestCaseName; - - } - - tstInput.projectPreferenceInfo = Datafactory.getProjectPreferenceInfo(); - tstInput.environmentData = $rootScope.environmentData; - tstInput.writeFileToolList=Datafactory.getWriteFileDataList(); - tstInput.fileStreamWriterList=Datafactory.getFileStreamWriterList(); - tstInput.commonPythonScriptList = Datafactory.getCommonPythonScriptList(); - - - soapRequestService.generateTst(tstInput, generateTSTUrl) - .then(function(pars) { - console.log("pars"); - - - var dlg = dialogs.confirm('Message','Do you want to download TST file?'); - dlg.result.then(function(btn){ - console.log("btn"); - $scope.confirmed = 'You confirmed "Yes."'; - var downloadTSTUrl ="/utm-service/soa_integration/downloadTST"; - - soapRequestService.downloadTst(pars, tstInput.activityTestCase.testCaseName, downloadTSTUrl) - .then(function(results) { - console.log("results"); - - var sets=results.data; - console.log("Sets value"+sets); - var headerValue=results.headers; - - var fileName=results.config.data.tstName + ".tst"; - console.log("Filename "+fileName); - - var hiddenElement = document.createElement('a'); - var objectUrl = URL.createObjectURL(results.data); - - hiddenElement.href = objectUrl; - hiddenElement.download = fileName; - - hiddenElement.target = '_blank'; - document.body.appendChild(hiddenElement); - hiddenElement.click(); - document.body.removeChild(hiddenElement); - - }); - },function(btn){ - console.log("btn"); - $scope.confirmed = 'You confirmed "No."'; - }); - - }, - function(data) { - console.log("data"); - }); - - - } + }]);
\ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/scripts/ExportFileCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/ExportFileCtrl.js deleted file mode 100644 index 3de9d34c1..000000000 --- a/src/main/resources/META-INF/resources/designer/scripts/ExportFileCtrl.js +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ -app.controller('exportCtrl', [ '$scope', '$rootScope', 'exportService', -'dialogs', function($scope, $rootScope, exportService, dialogs) { - console.log("exportCtrl"); -} ]); diff --git a/src/main/resources/META-INF/resources/designer/scripts/ExportFileService.js b/src/main/resources/META-INF/resources/designer/scripts/ExportFileService.js deleted file mode 100644 index e2474aaad..000000000 --- a/src/main/resources/META-INF/resources/designer/scripts/ExportFileService.js +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ -app.service('exportService', [ -'$http', -'$q', -function($http, $q) { - console.log("/////////exportService"); - this.exportToUrl = function(testsetValue, formatValue, exporturl) { - console.log("exportToUrl"); - var def = $q.defer(); - var sets = []; - var testExportRequest = { - testSet : testsetValue, - format : formatValue - }; - if (angular.equals(formatValue, "Excel")) { - $http({ - url : exporturl, - method : "POST", - data : testExportRequest, // this is your json data string - // headers: { - responseType : 'arraybuffer' - }).success(function(data, status, headers, config) { - console.log("success"); - /* - * sets = data; def.resolve(data); - */ - var results = []; - results.data = data; - results.headers = headers(); - results.status = status; - results.config = config; - def.resolve(results); - }).error(function(data) { - console.log("data"); - def.reject("Export file not successful"); - }); - } else { - $http.post(exporturl, testExportRequest).success( - function(data, status, headers, config) { - console.log("function"); - var results = []; - results.data = data; - results.headers = headers(); - results.status = status; - results.config = config; - def.resolve(results); - // alert("Data in success without scope and q_def for scope - // parametes :: " + parameters);'Content-type': - // 'application/json', - }).error(function(data) { - console.log("data"); - // alert("Data in error :: " + data); - def.reject("Export file not successful"); - }); - } - return def.promise; - }; -} ]); diff --git a/src/main/resources/META-INF/resources/designer/scripts/FileUploadCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/FileUploadCtrl.js deleted file mode 100644 index 9efbc49af..000000000 --- a/src/main/resources/META-INF/resources/designer/scripts/FileUploadCtrl.js +++ /dev/null @@ -1,155 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ -app -.controller( -'fileUploadCtrl', -[ -'$scope', -'$rootScope', -'fileUpload', -function($scope, $rootScope, fileUpload) { - console.log("///////////fileUploadCtrl"); - $rootScope.isAllOption = false; - // -----For Required Radio button functionality - $scope.requiredonly = function() { - console.log("requiredonly"); - // var tempArray = $rootScope.SUT; - // var tempParam = tempArray.parameters; - // alert("testParam.length:"+tempParam.length); - var parameter = $scope.parArray; - var param = $scope.parameters; - var i = 0; - $('.req').each(function() { - console.log(".req"); - var newID = 'requiredval' + i; - // jQuery(this).prev("req").attr("requiredval", "newID"); - // $(this).attr("requiredval","newID"); - // var newval=$(this).val(newID); - var newval = $(this).attr('id', newID); - console.log("Angular id: " + newval); - if (i < param.length) { - document.getElementById(newID).disabled = false; - if (parameter[i]) { - param[i].required = parameter[i]; - // document.getElementById(newID).disabled=true; - document.getElementById(newID).checked = true; - } else { - param[i].required = parameter[i]; - // document.getElementById(newID).disabled=false; - document.getElementById(newID).checked = false; - } - } - i++; - }); - }; - $scope.allrequired = function() { - console.log("allrequired"); - var param = $scope.parameters; - var i = 0; - $('.req').each(function() { - console.log("req"); - var newID = 'requiredval' + i; - // jQuery(this).prev("req").attr("requiredval", "newID"); - // $(this).attr("requiredval","newID"); - // var newval=$(this).val(newID); - var newval = $(this).attr('id', newID); - console.log("Angular id: " + newval); - if (i < param.length) { - param[i].required = true; - document.getElementById(newID).checked = true; - document.getElementById(newID).disabled = true; - } - i++; - }); - }; - $scope.uploadSUTFile = function(element) { - console.log("uploadSUTFile"); - $scope - .$apply(function($scope) { - console.log("apply"); - $rootScope.isAllOption = false; - $rootScope.isStatic = true; - $scope.requiredval = false; - $rootScope.rightTabName = "UTM Build Configuration"; - $rootScope.testSet = null; - if ($rootScope.isStatic == true) { - document.getElementById('buidConfigBtn').style.visibility = "hidden"; - } - var file = element.files[0];/* $scope.requestFile; */ - console.log('file is ' + JSON.stringify(file)); - $rootScope.file_type = "SUT"; - var uploadUrl = "/utm-service/sut_upload/uploadSUT"; - fileUpload.uploadFileToUrl(file, uploadUrl).then(function(pars) { - console.log("uploadFileToUrl"); - $rootScope.SUT = pars; - console.log("file name :" + pars.name); - $scope.fileName = pars.name; - $scope.parameters = pars.parameters; - $scope.constraints = pars.constraints; - $scope.relations = pars.relations; - var con = $scope.constraints; - }, function(data) { - console.log("data"); - // alert("File upload failed and parameters not returned"); - }); - angular.forEach(angular.element("input[type='file']"), - function(inputElem) { - console.log("inputElem"); - angular.element(inputElem).val(null); - }); - }); - }; - $scope.buildConfig = function() { - console.log("buildConfig"); - $rootScope.isStatic = true; - $rootScope.rightTabName = "UTM Build Configuration"; - document.getElementById('buidConfigBtn').style.visibility = "hidden"; - $rootScope.testset = null; - }; - /* - * $scope.close = function(){ $modalInstance.close('closed'); }; - * - * $scope.importSchema= function(){ var file = $scope.requestFile; - * console.log('file is ' + JSON.stringify(file)); var uploadUrl = - * "/utm-service/schema_upload/uploadSchema"; - * fileUpload.uploadFileToUrl(file, uploadUrl) .then(function(pars) { - * $rootScope.SUT = pars; console.log("file name :"+pars.name); - * $scope.fileName = pars.name; $scope.parameters = pars.parameters; var - * param = pars.parameters; }, function(data) { //alert("File upload failed - * and parameters not returned"); }); - * - * }; - */ -} ]); -function clearFileInput(id) { - console.log("clearFileInput"); - var oldInput = document.getElementById(id); - var newInput = document.createElement("input"); - newInput.type = "file"; - newInput.id = oldInput.id; - newInput.name = oldInput.name; - newInput.className = oldInput.className; - newInput.style.cssText = oldInput.style.cssText; - // TODO: copy any other relevant attributes - oldInput.parentNode.replaceChild(newInput, oldInput); -} diff --git a/src/main/resources/META-INF/resources/designer/scripts/FileUploadService.js b/src/main/resources/META-INF/resources/designer/scripts/FileUploadService.js deleted file mode 100644 index d1826a9e9..000000000 --- a/src/main/resources/META-INF/resources/designer/scripts/FileUploadService.js +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ -app.directive('fileModel', [ '$parse', function($parse) { - console.log("////////fileModel"); - return { - restrict : 'A', - link : function(scope, element, attrs) { - console.log("link"); - var model = $parse(attrs.fileModel); - // alert("uploadFileToUrl directive model :: " + model); - var modelSetter = model.assign; - element.bind('change', function() { - console.log("change"); - scope.$apply(function() { - console.log("apply"); - modelSetter(scope, element[0].files[0]); - }); - }); - } - }; -} ]); -app.service('fileUpload', [ '$http', '$q', function($http, $q) { - console.log("fileUpload"); - this.uploadFileToUrl = function(file, uploadUrl) { - console.log("uploadFileToUrl"); - var def = $q.defer(); - var pars = []; - var fd = new FormData(); - fd.append('requestFile', file); - $http.post(uploadUrl, fd, { - transformRequest : angular.identity, - headers : { - 'Content-Type' : undefined - } - }).success(function(data) { - console.log("success"); - pars = data; - def.resolve(data); - }).error(function(data) { - console.log("error"); - def.reject("Upload file not successful"); - }); - return def.promise; - }; - this.uploadFile = function(path, inputFile, uploadURL) { - console.log("uploadFile"); - var def = $q.defer(); - var pars = []; - var fd = new FormData(); - fd.append('requestFile', inputFile); - fd.append('path', path) - $http.post(uploadURL, fd, { - transformRequest : angular.identity, - headers : { - 'Content-Type' : undefined - } - }).success(function(data) { - console.log("success"); - pars = data; - def.resolve(data); - }).error(function(data) { - console.log("error"); - def.reject("Upload file not successful"); - }); - return def.promise; - }; -} ]);
\ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js deleted file mode 100644 index e2f1913d0..000000000 --- a/src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js +++ /dev/null @@ -1,296 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ -app -.controller( -'ImportSchemaCtrl', -[ -'$scope', -'$rootScope', -'$uibModalInstance', -'data', -'svnservice', -'fileUpload', -'dialogs', -function($scope, $rootScope, $uibModalInstance, data, svnservice, fileUpload, - dialogs) { - console.log("//////ImportSchemaCtrl"); - $rootScope.serviceInfo; - $rootScope.serviceInput; - $rootScope.serviceOutput; - $rootScope.serviceFault; - $rootScope.serviceInputPartInfo; - $rootScope.schemElemant1; - $rootScope.updateServiceInfo; - $rootScope.updateServiceInput; - $rootScope.updateServiceOutput; - $rootScope.updateServiceFault; - $rootScope.updateServiceInputPartInfo; - $rootScope.updateSchemElemant1; - // Below code is added to get the policyNames - var policies = getOperationalPolicyProperty(); - for ( var obj in policies) { - if (!($.isEmptyObject(obj))) { - allPolicies = jQuery.extend({}, obj); - $scope.policyNames = []; - for ( var policy in allPolicies) { - $scope.policyNames.push(policy); - } - } - } - setTimeout(function() { - console.log("setTimeout"); - setMultiSelect(); - }, 100); - $scope.close = function() { - console.log("close"); - $uibModalInstance.close("closed"); - }; - $rootScope.file_path; - $scope.importSchema = function() { - console.log("importSchema"); - isImportSchema = true; - var file = $rootScope.file_path; - // alert("file:"+schemaFile); - // console.log('file is ' + JSON.stringify(file)); - var userID = document.getElementById("userID").value; - var password = document.getElementById("password").value; - var svnURL = document.getElementById("schemaLocation").value; - var schemaLocation = document.getElementById("schemaLocation").value; - if (schemaLocation && userID && password - && document.getElementById("schemaLocation").disabled == false) { - $scope.schemaLocation = schemaLocation; - $scope.userID = userID; - $scope.password = password; - document.getElementById("fileUpload").disabled = true; - var svnUploadURL = "/utm-service/schema_upload/svnUploadWSDL"; - svnservice - .SVNToUrl(schemaLocation, userID, password, svnURL, svnUploadURL) - .then( - function(pars) { - console.log("pars"); - document.getElementById('Upgrade Schema Version').classList - .remove('ThisLink'); - document.getElementById('Set Default Values').classList - .remove('ThisLink'); - $rootScope.wsdlInfo = angular.fromJson(pars); - $rootScope.serviceInfo = $rootScope.wsdlInfo.serviceInfo; - serviceName = $rootScope.serviceInfo.service.name; - $rootScope.schemaLocation = $rootScope.wsdlInfo.schemaLocation; - $rootScope.serviceInput = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage; - $rootScope.serviceInputPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage.partInfo; - $rootScope.serviceOutput = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage; - $rootScope.serviceOutputPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage.partInfo; - $rootScope.servicefault = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage; - $rootScope.servicefaultPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage.partInfo; - // alert("serviceInputPartInfo :: " + - // JSON.stringify($rootScope.serviceInputPartInfo)); - $rootScope.inputSchemaServiceInputPartInfo = []; - $rootScope.inputSchemaServiceOutputPartInfo = []; - $rootScope.inputSchemaServicefaultPartInfo = []; - angular.copy($rootScope.serviceInputPartInfo, - $rootScope.inputSchemaServiceInputPartInfo); - angular.copy($rootScope.serviceOutputPartInfo, - $rootScope.inputSchemaServiceOutputPartInfo); - angular.copy($rootScope.servicefaultPartInfo, - $rootScope.inputSchemaServicefaultPartInfo); - $rootScope.isModel = true; - }, function(data) { - console.log("data"); - // alert("File upload failed and parameters not returned"); - }); - } else { - var uploadUrl = "/utm-service/schema_upload/uploadWSDL"; - fileUpload - .uploadFileToUrl(file, uploadUrl) - .then( - function(pars) { - console.log("pars"); - document.getElementById('Upgrade Schema Version').classList - .remove('ThisLink'); - document.getElementById('Set Default Values').classList - .remove('ThisLink'); - // document.getElementById('Define/Modify - // Schema').classList.remove('ThisLink'); - $rootScope.wsdlInfo = angular.fromJson(pars); - $rootScope.serviceInfo = $rootScope.wsdlInfo.serviceInfo; - serviceName = $rootScope.serviceInfo.service.name; - $rootScope.serviceInput = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage; - $rootScope.serviceInputPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage.partInfo; - // alert("Input Part Info :: " + - // JSON.stringify($rootScope.serviceInputPartInfo)); - // alert("Input Part 1 Info :: " + - // JSON.stringify($rootScope.serviceInputPartInfo[1])); - // alert("Input Element :: " + - // JSON.stringify($rootScope.serviceInputPartInfo[1].schemaElements[1].elements[0])); - $rootScope.serviceOutput = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage; - $rootScope.serviceOutputPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage.partInfo; - $rootScope.servicefault = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage; - $rootScope.servicefaultPartInfo = $rootScope.serviceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage.partInfo; - // alert("servicefaultPartInfo :: " + - // JSON.stringify($rootScope.servicefaultPartInfo)); - $rootScope.inputSchemaServiceInputPartInfo = []; - $rootScope.inputSchemaServiceOutputPartInfo = []; - $rootScope.inputSchemaServicefaultPartInfo = []; - angular.copy($rootScope.serviceInputPartInfo, - $rootScope.inputSchemaServiceInputPartInfo); - angular.copy($rootScope.serviceOutputPartInfo, - $rootScope.inputSchemaServiceOutputPartInfo); - angular.copy($rootScope.servicefaultPartInfo, - $rootScope.inputSchemaServicefaultPartInfo); - $rootScope.isModel = true; - }, function(data) { - console.log("data"); - }); - } - $uibModalInstance.close("closed"); - }; - $scope.setFile = function(element) { - console.log("setFile"); - $scope.$apply(function($scope) { - console.log("apply"); - $scope.theFile = element.files[0]; - $rootScope.fileName = $scope.theFile.name; - var file = element.files[0]; - $rootScope.file_path = file; - // $uibModalInstance.close("closed"); - angular.element(document.getElementById('fileUpload')).val(null); - }); - }; - $scope.setUpgradeFile = function(element) { - console.log("setUpgradeFile"); - $scope.$apply(function($scope) { - console.log("apply"); - $scope.theUpgradeFile = element.files[0]; - $rootScope.upgradeFileName = $scope.theUpgradeFile.name; - // alert("fname1"+$rootScope.upgradeFileName); - var file = element.files[0]; - $rootScope.file_path = file; - // $uibModalInstance.close("closed"); - angular.element(document.getElementById('fileUpload')).val(null); - }); - }; - $scope.reset = function() { - console.log("reset"); - document.getElementById("fileUpload").disabled = false; - document.getElementById("schemaLocation").disabled = false; - document.getElementById("userID").disabled = false; - document.getElementById("password").disabled = false; - document.getElementById("schemaLocation").value = ''; - document.getElementById("userID").value = ''; - document.getElementById("password").value = ''; - $scope.theFile = null; - angular.element(document.getElementById('fileUpload')).val(null); - }; - $scope.upgradeSchema = function() { - console.log("upgradeSchema"); - // alert("inside upgrade schema"); - var file = $rootScope.file_path; - // alert("file:"+schemaFile); - // console.log('file is ' + JSON.stringify(file)); - var userID = document.getElementById("userID").value; - var password = document.getElementById("password").value; - var schemaLocation = document.getElementById("upgradeSchemaLocation").value; - var svnURL = document.getElementById("upgradeSchemaLocation").value; - console.log("after"); - $rootScope.Currentmappedvalues = []; - if (schemaLocation && userID && password - && document.getElementById("upgradeSchemaLocation").disabled == false) { - $scope.schemaLocation = schemaLocation; - $scope.userID = userID; - $scope.password = password; - document.getElementById("fileUpload").disabled = true; - var svnUploadURL = "/utm-service/schema_upload/svnUploadWSDL"; - svnservice - .SVNToUrl(schemaLocation, userID, password, svnURL, svnUploadURL) - .then( - function(pars) { - console.log("pars"); - $rootScope.updateWsdlInfo = angular.fromJson(pars); - $rootScope.updateServiceInfo = $rootScope.updateWsdlInfo.serviceInfo; - $rootScope.schemaLocation = $rootScope.updateWsdlInfo.schemaLocation; - $rootScope.updateServiceInput = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage; - $rootScope.updateServiceInputPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage.partInfo; - $rootScope.updateServiceOutput = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage; - $rootScope.updateServiceOutputPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage.partInfo; - $rootScope.updateServicefault = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage; - $rootScope.updateServicefaultPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage.partInfo; - // alert("serviceInputPartInfo :: " + - // JSON.stringify($rootScope.serviceInputPartInfo)); - // $rootScope.isModel = true; - }, function(data) { - console.log("data"); - // alert("File upload failed and parameters not returned"); - }); - } else { - var uploadUrl = "/utm-service/schema_upload/uploadWSDL"; - fileUpload - .uploadFileToUrl(file, uploadUrl) - .then( - function(pars) { - console.log("pars"); - $rootScope.updateWsdlInfo = angular.fromJson(pars); - // alert("wsdlinfo:"+$rootScope.updateWsdlInfo); - $rootScope.updateServiceInfo = $rootScope.updateWsdlInfo.serviceInfo; - $rootScope.updateServiceInput = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage; - $rootScope.updateServiceInputPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].inputMessage.partInfo; - $rootScope.updateServiceOutput = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage; - $rootScope.updateServiceOutputPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].outputMessage.partInfo; - $rootScope.updateServicefault = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage; - $rootScope.updateServicefaultPartInfo = $rootScope.updateServiceInfo.bindingInfo.portTypeInfo.operationInfo[0].faultMessage.partInfo; - // alert("servicefaultPartInfo :: " + - // JSON.stringify($rootScope.servicefaultPartInfo)); - // $rootScope.isModel = true; - }, function(data) { - console.log("data"); - }); - } - $uibModalInstance.close("closed"); - var dlg = dialogs.create( - 'partials/portfolios/upgrade_schema_dtls.html', 'UpgradeSchemaCtrl', - {}, { - size : 'xlg', - keyboard : true, - backdrop : true, - windowClass : 'my-class' - }); - dlg.result.then(function(name) { - console.log("dlg.result"); - // $scope.name = name; - }, function() { - // if(angular.equals($scope.name,'')) - // $scope.name = 'You did not enter in your name!'; - }); - }; - - $scope.submitForm = function(obj) { - var operationalPolicies = JSON.parse(JSON.stringify(getOperationalPolicies())); - if (obj !== null) { - operationalPolicies[0]["configurationsJson"] = obj; - } - svnservice.saveOpPolicyProperties(operationalPolicies).then(function(pars) { - updateOpPolicyProperties(operationalPolicies); - }, function(data) { - }); - }; - -} ]);
\ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js new file mode 100644 index 000000000..d1f3e0c45 --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ +app +.controller( +'operationalPolicyCtrl', +[ +'$scope', +'$rootScope', +'$uibModalInstance', +'data', +'operationalPolicyService', +'dialogs', +function($scope, $rootScope, $uibModalInstance, data, operationalPolicyService, + dialogs) { + console.log("//////operationalPolicyCtrl"); + $rootScope.serviceInfo; + $rootScope.serviceInput; + $rootScope.serviceOutput; + $rootScope.serviceFault; + $rootScope.serviceInputPartInfo; + $rootScope.schemElemant1; + $rootScope.updateServiceInfo; + $rootScope.updateServiceInput; + $rootScope.updateServiceOutput; + $rootScope.updateServiceFault; + $rootScope.updateServiceInputPartInfo; + $rootScope.updateSchemElemant1; + // Below code is added to get the policyNames + var policies = getOperationalPolicyProperty(); + for ( var obj in policies) { + if (!($.isEmptyObject(obj))) { + allPolicies = jQuery.extend({}, obj); + $scope.policyNames = []; + for ( var policy in allPolicies) { + $scope.policyNames.push(policy); + } + } + } + setTimeout(function() { + console.log("setTimeout"); + setMultiSelect(); + }, 100); + $scope.close = function() { + console.log("close"); + $uibModalInstance.close("closed"); + }; + + $scope.submitForm = function(obj) { + var operationalPolicies = JSON.parse(JSON.stringify(getOperationalPolicies())); + if (obj !== null) { + operationalPolicies[0]["configurationsJson"] = obj; + } + operationalPolicyService.saveOpPolicyProperties(operationalPolicies).then(function(pars) { + updateOpPolicyProperties(operationalPolicies); + }, function(data) { + }); + }; + +} ]);
\ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/scripts/importSchemaService.js b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyService.js index c355d7523..9c83ca8c7 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/importSchemaService.js +++ b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyService.js @@ -20,32 +20,8 @@ * =================================================================== * */ -app.service('svnservice', ['$http', '$q', function ($http, $q) { - console.log("//////svnservice"); - this.SVNToUrl = function(schemaLocation, userID, password,svnURL,svnUploadURL){ - console.log("SVNToUrl"); - - - var def = $q.defer(); - var sets = []; - - var svnRequest = {schemaLocation: schemaLocation, userID: userID, password: password,svnURL:svnURL}; - - - $http.post(svnUploadURL, svnRequest) - .success(function(data){ - console.log("success"); - pars = data; - def.resolve(data); - - }) - .error(function(data){ - console.log("error"); - def.reject("SVN Import not successful"); - }); - - return def.promise; - }; +app.service('operationalPolicyService', ['$http', '$q', function ($http, $q) { + console.log("//////OperationalPolicyService"); this.saveOpPolicyProperties = function(form) { var modelName = getLoopName(); diff --git a/src/main/resources/META-INF/resources/designer/scripts/UpgradeSchemaCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/UpgradeSchemaCtrl.js deleted file mode 100644 index db8b126a1..000000000 --- a/src/main/resources/META-INF/resources/designer/scripts/UpgradeSchemaCtrl.js +++ /dev/null @@ -1,479 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ -var elementKeys = []; -app -.directive( -'inputInfoUpgradeClass', -function($compile) { - console.log("////UpgradeSchemaCtrl"); - return { - restrict : "C", - replace : true, - link : function(scope, element, attrs) { - var elementHTML = ''; - angular - .forEach( - scope.infoType.schemaElements, - function(value, key) { - scope.schemaElement = value; - if (scope.schemaElement.complexType != null) { - if (scope.currentElementName == '') { - scope.currentElementName = scope.schemaElement.complexType.name; - } - scope.ParentKey = scope.parentName + '_' - + scope.currentElementName; - if (scope.schemaElement.repeatableHierarchicalPrefix != null) { - scope.ParentKey = scope.ParentKey - + scope.schemaElement.repeatableHierarchicalPrefix; - } - scope.parElement = scope.schemaElement; - scope.tableStyle = 'table-level' + scope.heirarchyLevel - + '-tree'; - scope.tdLabelStyle = 'td-level' + scope.heirarchyLevel - + '-label-tree'; - scope.heirLevel = scope.heirarchyLevel; - elementHTML = elementHTML - + '<div ng-show="schemaElement.complexType != null">'; - elementHTML = elementHTML - + '<table class="{{tableStyle}}"> <tr>'; - elementHTML = elementHTML + '<td class="{{tdLabelStyle}}">'; - elementHTML = elementHTML - + '<span class="pull-left" ng-click="showUTMViewMsgHeader=!showUTMViewMsgHeader">'; - elementHTML = elementHTML - + '<i ng-class="showUTMViewMsgHeader == true ?\'fa fa-plus-circle\':\'fa fa-minus-circle\'"></i>'; - elementHTML = elementHTML + '</span>'; - elementHTML = elementHTML + '<b>{{currentElementName}}</b>'; - elementHTML = elementHTML + '</td>'; - elementHTML = elementHTML + '<td class="td-tree"></td>'; - elementHTML = elementHTML - + '<td class="td-default_value-tree"> </td>'; - elementHTML = elementHTML + '</tr></table>'; - elementHTML = elementHTML - + '<div style="margin-left: 10px" ng-class="{hidden:showUTMViewMsgHeader,chaldean:showUTMViewMsgHeader}">'; - elementHTML = elementHTML - + '<div class="inputInfoUpgradeClassMember" style="margin-left: 10px" ng-repeat="schemaElement in schemaElement.elements"></div>'; - elementHTML = elementHTML + '</div>'; - elementHTML = elementHTML + '</div>'; - var x = angular.element(elementHTML); - element.append(x); - $compile(x)(scope); - } - }); - } - } -}); -app -.directive( -'inputInfoUpgradeClassMember', -function($compile) { - return { - restrict : "C", - link : function(scope, element, attrs) { - var elementHTML = ''; - scope.currentElementName = scope.objectName; - scope.parentName = scope.ParentKey; - scope.parentElement = scope.parElement; - scope.heirarchyLevel = scope.heirLevel + 1; - if (scope.schemaElement.element.name != null) { - scope.elementKey = scope.parentName + '_' - + scope.schemaElement.element.name; - if (scope.schemaElement.repeatableHierarchicalPrefix != null) { - scope.elementKey = scope.elementKey - + scope.schemaElement.repeatableHierarchicalPrefix; - } - scope.tableStyle = 'table-level' + scope.heirarchyLevel + '-tree'; - scope.tdLabelStyle = 'td-level' + scope.heirarchyLevel - + '-label-tree'; - if (scope.schemaElement.type.complexType != null) { - scope.showUTMViewMsgHeader = false; - } else { - scope.showUTMViewMsgHeader = true; - } - elementHTML = elementHTML - + '<div ng-show="schemaElement.element.name != null">'; - elementHTML = elementHTML + '<table class="{{tableStyle}}"> '; - elementHTML = elementHTML + '<tr>'; - elementHTML = elementHTML - + '<td style="text-align: left;vertical-align: top;" class="{{tdLabelStyle}}">'; - elementHTML = elementHTML - + '<span class="pull-left" ng-click="showUTMViewMsgHeader=!showUTMViewMsgHeader">'; - elementHTML = elementHTML + '<div style="display:inline">'; - elementHTML = elementHTML - + '<input type="radio" name={{radioName}} id="{{elementKey}}" value={{schemaElement.element.name}}>'; - elementHTML = elementHTML + '</div>'; - elementHTML = elementHTML - + '<i expandable ng-class="showUTMViewMsgHeader == true ?\'fa fa-minus-circle\':\'fa fa-plus-circle\'"></i>'; - elementHTML = elementHTML + '{{schemaElement.element.name}} '; - elementHTML = elementHTML + ''; - elementHTML = elementHTML + ''; - elementHTML = elementHTML + ''; - elementHTML = elementHTML + ''; - elementHTML = elementHTML + '</span>'; - elementHTML = elementHTML - + '<div ng-init="complexMapElements(elementKey,schemaElement,radioName)"></div>'; - elementHTML = elementHTML + '</td>'; - elementHTML = elementHTML + '</tr>'; - elementHTML = elementHTML + '</table>'; - elementHTML = elementHTML + ''; - elementHTML = elementHTML + ''; - elementHTML = elementHTML + '</div>'; - var x = angular.element(elementHTML); - element.append(x); - $compile(x)(scope); - if (scope.schemaElement.type.complexType != null) { - var elementHTML2 = '<div ng-show="schemaElement.type.complexType != null">' - elementHTML2 = elementHTML2 - + '<div ng-init="parKey=parentName + \'_\' + schemaElement.element.name + (schemaElement.repeatableHierarchicalPrefix != null ? schemaElement.repeatableHierarchicalPrefix : \'\'); heirLevel=heirarchyLevel; parElement=schemaElement; ParentKey=ParentKey+\'_\'+schemaElement.element.name + (schemaElement.repeatableHierarchicalPrefix != null ? schemaElement.repeatableHierarchicalPrefix : \'\')">' - elementHTML2 = elementHTML2 - + '<div style="margin-left: 10px" ng-class="{hidden:!showUTMViewMsgHeader,chaldean:!showUTMViewMsgHeader}">' - elementHTML2 = elementHTML2 - + '<div class="{{sourceExplorer+\'_\'+parKey}}"></div>' - elementHTML2 = elementHTML2 + '</div>' - elementHTML2 = elementHTML2 + '</div>' - elementHTML2 = elementHTML2 + '</div>'; - var x = angular.element(elementHTML2); - element.append(x); - $compile(x)(scope); - } - } - } - } -}); -app -.controller( -'UpgradeSchemaCtrl', -[ -'$scope', -'$rootScope', -'$uibModalInstance', -'dialogs', -function($scope, $rootScope, $uibModalInstance, dialogs) { - $rootScope.Currentmappedvalues = []; - $scope.utmSchemaExts = {}; - $scope.callFromMap = false; - $scope.oldMapValFlag = false; - $scope.complexMappedValuesOld = {}; - $scope.complexMappedValuesNew = {}; - var allCurrentElementKeyArray = []; - $scope.checkedValues = {}; - var checkedElementValueArray = []; - $scope.complexMapElements = function(elementKey, schemaElement, radioName) { - if (schemaElement.complexType != null - || (schemaElement.type != null && schemaElement.type.complexType != null)) { - if (radioName == "oldChk") - $scope.complexMappedValuesOld[elementKey] = schemaElement; - else if (radioName == "newChk") - $scope.complexMappedValuesNew[elementKey] = schemaElement; - } - if (elementKey != null) - allCurrentElementKeyArray.push(elementKey); - }; - $scope.mapElements = function() { - var oldVal = $('input[name=oldChk]:checked').val(); - var newVal = $('input[name=newChk]:checked').val(); - var oldId = $('input[name=oldChk]:checked').attr('id'); - var newId = $('input[name=newChk]:checked').attr('id'); - $scope.mappedvalues = {}; - $scope.checkedValues.oldVal = oldVal; - $scope.checkedValues.newVal = newVal; - checkedElementValueArray.push($scope.checkedValues); - $scope.oldMappedvaluesKeyArray = []; - $scope.newMappedvaluesKeyArray = []; - $scope.oldmappedvaluesArray = []; - $scope.newMappedvaluesArray = []; - if ($scope.complexMappedValuesOld[oldId] != null - && $scope.complexMappedValuesNew[newId] != null) { - $scope.matchType = ''; - $scope.matchType = $scope.compareElements( - $scope.complexMappedValuesOld[oldId], - $scope.complexMappedValuesNew[newId]); - if ($scope.matchType == "true") { - console - .log("Element Type Matches and eligible for upgrade schema"); - $scope.callFromMap = true; - for (var i = 0; i < $scope.complexMappedValuesOld[oldId].type.elements.length; i++) { - $scope.oldMapValFlag = true; - getElementkeys(oldId, - $scope.complexMappedValuesOld[oldId].type.elements[i]); - } - for (var j = 0; j < $scope.complexMappedValuesNew[newId].type.elements.length; j++) { - $scope.oldMapValFlag = false; - getElementkeys(newId, - $scope.complexMappedValuesNew[newId].type.elements[j]); - } - for (var k = 0; k < $scope.oldmappedvaluesArray.length; k++) { - $scope.mappedvalues = {}; - $scope.mappedvalues.oldvalue = $scope.oldmappedvaluesArray[k]; - $scope.mappedvalues.newvalue = $scope.newMappedvaluesArray[k]; - $scope.mappedvalues.oldidvalue = $scope.oldMappedvaluesKeyArray[k]; - $scope.mappedvalues.newidvalue = $scope.newMappedvaluesKeyArray[k]; - $rootScope.Currentmappedvalues.push($scope.mappedvalues); - } - } else if ($scope.matchType == "false") { - dialogs - .error( - 'Invalid Selection Error', - 'The mapping of the selected elements is invalid. Please select valid complex elements for Upgrade Schema'); - } - } else if (($scope.complexMappedValuesOld[oldId] == null && $scope.complexMappedValuesNew[newId] != null) - || ($scope.complexMappedValuesOld[oldId] != null && $scope.complexMappedValuesNew[newId] == null)) { - dialogs - .error( - 'Invalid Selection Error', - 'The mapping of the selected elements is invalid. Please select valid complex elements for Upgrade Schema'); - } else { - $scope.mappedvalues.oldvalue = oldVal; - $scope.mappedvalues.newvalue = newVal; - $scope.mappedvalues.oldidvalue = oldId; - $scope.mappedvalues.newidvalue = newId; - $rootScope.Currentmappedvalues.push($scope.mappedvalues); - } - $rootScope.checkRepeatable = false; - }; - // Utility Method to compare Object Structure of Complex Type Elements - // before upgrade schema - $scope.compareElements = function(oldElement, newElement) { - if (oldElement.type.complexType != null - && newElement.type.complexType != null) { - if (oldElement.type.elements.length == newElement.type.elements.length) { - for (var i = 0; i < oldElement.type.elements.length; i++) { - if (oldElement.type.elements[i].type.complexType != null - && newElement.type.elements[i].type.complexType != null) { - $scope.compareElements(oldElement.type.elements[i], - newElement.type.elements[i]); - } else if (oldElement.type.elements[i].type.complexType == null - && newElement.type.elements[i].type.complexType != null) { - $scope.matchType = "false"; - return $scope.matchType; - } - if ($scope.matchType == "false") - return $scope.matchType; - } - for (var i = 0; i < newElement.type.elements.length; i++) { - if (newElement.type.elements[i].type.complexType != null - && oldElement.type.elements[i].type.complexType != null) { - $scope.compareElements(newElement.type.elements[i], - oldElement.type.elements[i]); - } else if (newElement.type.elements[i].type.complexType == null - && oldElement.type.elements[i].type.complexType != null) { - $scope.matchType = "false"; - return $scope.matchType; - } - if ($scope.matchType == "false") - return $scope.matchType; - } - $scope.matchType = "true"; - return $scope.matchType; - } else - $scope.matchType = "false"; - return $scope.matchType; - } - }; - $scope.checkRepeatableElement = function(elementKey, key) { - if (elementKey != key) - $rootScope.checkRepeatable = true; - }; - $scope.upgradeSchema = function() { - // console.log("List Model Path Details before Upgrade Schema :: " + - // JSON.stringify(list_model_path_details[selected_model])); - $scope.callFromMap = false; - $rootScope.isHorR = true; - $rootScope.repeatableHeirarchicalElementMap = map_model_repeatable_heirarchical_elements[selected_model]; - // Checking Repeatable Hierarchical elements mapping and changing - // elementkey if repeatable hierarchical is mapped - for ( var key in $rootScope.repeatableHeirarchicalElementMap) { - for (var i = 0; i < allCurrentElementKeyArray.length; i++) { - if (allCurrentElementKeyArray[i].indexOf(key) > -1) - elementKeys.push(allCurrentElementKeyArray[i]); - } - for (var j = 0; j < checkedElementValueArray.length; j++) { - var currentCheckedMappedvalue = checkedElementValueArray[j]; - if (key.indexOf(currentCheckedMappedvalue.oldVal) > -1) { - var newObject = JSON - .stringify($rootScope.repeatableHeirarchicalElementMap); - var oldvalue = currentCheckedMappedvalue.oldVal; - var newvalue = currentCheckedMappedvalue.newVal; - var modObject = newObject.replace(oldvalue, newvalue); - $rootScope.repeatableHeirarchicalElementMap = angular - .fromJson(modObject); - } - } - } - $scope.oldSchemaLocation = $rootScope.wsdlInfo.schemaLocation; - $rootScope.wsdlInfo = $rootScope.updateWsdlInfo; - $rootScope.wsdlInfo.schemaUpgradedFlag = true; - $rootScope.wsdlInfo.oldSchemaLocation = $scope.oldSchemaLocation; - $rootScope.serviceInfo = $rootScope.updateServiceInfo; - $rootScope.schemaLocation = $rootScope.updateWsdlInfo.schemaLocation; - $rootScope.serviceInput = $rootScope.updateServiceInput; - $rootScope.serviceInputPartInfo = $rootScope.updateServiceInputPartInfo; - $rootScope.inputSchemaServiceInputPartInfo = []; - $rootScope.inputSchemaServiceOutputPartInfo = []; - $rootScope.inputSchemaServicefaultPartInfo = []; - angular.copy($rootScope.serviceInputPartInfo, - $rootScope.inputSchemaServiceInputPartInfo); - angular.copy($rootScope.serviceOutputPartInfo, - $rootScope.inputSchemaServiceOutputPartInfo); - angular.copy($rootScope.servicefaultPartInfo, - $rootScope.inputSchemaServicefaultPartInfo); - // Form all the element keys of the Upgraded Schema so that to know the - // attibutes removed - for (var i = 0; i < $rootScope.serviceInputPartInfo.length; i++) { - for (var j = 0; j < $rootScope.serviceInputPartInfo[i].schemaElements.length; j++) { - getElementkeys('ServiceInput', - $rootScope.serviceInputPartInfo[i].schemaElements[j]); - } - } - $rootScope.serviceOutput = $rootScope.updateServiceOutput; - $rootScope.serviceOutputPartInfo = $rootScope.updateServiceOutputPartInfo; - for (var i = 0; i < $rootScope.serviceOutputPartInfo.length; i++) { - for (var j = 0; j < $rootScope.serviceOutputPartInfo[i].schemaElements.length; j++) { - getElementkeys('ServiceOutput', - $rootScope.serviceOutputPartInfo[i].schemaElements[j]); - } - } - $rootScope.servicefault = $rootScope.updateServicefault; - $rootScope.servicefaultPartInfo = $rootScope.updateServicefaultPartInfo; - for (var i = 0; i < $rootScope.servicefaultPartInfo.length; i++) { - for (var j = 0; j < $rootScope.servicefaultPartInfo[i].schemaElements.length; j++) { - getElementkeys('ServiceFault', - $rootScope.servicefaultPartInfo[i].schemaElements[j]); - } - } - console.log("mapped values of current" - + JSON.stringify($rootScope.Currentmappedvalues)); - // For each model in the project - // a) For the mapped elements - // i) replace the old ids with new ids for the Schema Extensions - // ii) replace the old ids with new ids for the Path Details - // b) For the deleted attributes in the Upgraded schema - // i) Remove the ids from Schema Extensions - // ii) Remove the ids from Path Details - for (var modelIndex = 0; modelIndex < $rootScope.models.length; modelIndex++) { - var current_model = $rootScope.models[modelIndex]; - $scope.utmSchemaExts = list_model_schema_extensions[current_model].utmSchemaExtentionMap; - $scope.pathDetailsArray = list_model_path_details[current_model]; - for (var i = 0; i < $rootScope.Currentmappedvalues.length; i++) { - $scope.mappedvalues = $rootScope.Currentmappedvalues[i]; - if ($scope.utmSchemaExts != null) { - $scope.utmSchemaExts[$scope.mappedvalues.newidvalue] = $scope.utmSchemaExts[$scope.mappedvalues.oldidvalue]; - if ($scope.mappedvalues.newidvalue != $scope.mappedvalues.oldidvalue) - delete $scope.utmSchemaExts[$scope.mappedvalues.oldidvalue]; - } - if ($scope.pathDetailsArray != null - && $scope.pathDetailsArray.length > 0) { - for (var k = 0; k < $scope.pathDetailsArray.length; k++) { - $scope.pathDetails = $scope.pathDetailsArray[k]; - if ($scope.pathDetails != null) { - for (var j = 0; j < $scope.pathDetails.decisionIdentifiers.length; j++) { - if ($scope.pathDetails.decisionIdentifiers[j].elementValues[$scope.mappedvalues.oldidvalue] != null) - $scope.pathDetails.decisionIdentifiers[j].elementValues[$scope.mappedvalues.newidvalue] = $scope.pathDetails.decisionIdentifiers[j].elementValues[$scope.mappedvalues.oldidvalue]; - if ($scope.mappedvalues.newidvalue != $scope.mappedvalues.oldidvalue) - delete $scope.pathDetails.decisionIdentifiers[j].elementValues[$scope.mappedvalues.oldidvalue]; - } - } - } - } - } - $scope.schemenExts = angular.copy($scope.utmSchemaExts); - // If an attribute is removed from upgraded schema, remove that - // attribute related details from SchemaExtensions - Object.keys($scope.schemenExts).forEach(function(key) { - var key_isavailable = false; - for (var j = 0; j < elementKeys.length; j++) { - if (elementKeys[j] === key) { - key_isavailable = true; - } - } - if (!key_isavailable) { - // Implement this later. Commented this as this is wiping - // out all the Repeatable/Heirarchical values - // delete $scope.utmSchemaExts[key]; - } - }); - // If an attribute is removed from upgraded schema, remove that - // attribute related details from PathDetails - if ($scope.pathDetailsArray != null - && $scope.pathDetailsArray.length > 0) { - for (var k = 0; k < $scope.pathDetailsArray.length; k++) { - $scope.pathDetails = $scope.pathDetailsArray[k]; - for (var j = 0; j < $scope.pathDetails.decisionIdentifiers.length; j++) { - $scope.decisionElementValues = angular - .copy($scope.pathDetails.decisionIdentifiers[j].elementValues); - Object.keys($scope.decisionElementValues).forEach( - function(key) { - var key_isavailable = false; - for (var l = 0; l < elementKeys.length; l++) { - if (elementKeys[l] === key) { - key_isavailable = true; - } - } - if (!key_isavailable) { - // Implement this later. Commented this as this - // is wiping out all the Repeatable/Heirarchical - // values - // delete - // $scope.pathDetails.decisionIdentifiers[j].elementValues[key]; - } - }); - } - } - } - } - $uibModalInstance.close("closed"); - }; - $scope.close = function() { - $uibModalInstance.close("closed"); - }; - function getElementkeys(parentname, schemaelement) { - if (schemaelement.complexType != null) { - var parentkey = parentname + "_" + schemaelement.complexType.name; - for (var i = 0; i < schemaelement.elements.length; i++) { - getElementkeys(parentkey, schemaelement.elements[i]); - } - } - if (schemaelement.element != null && schemaelement.element.name != null) { - var elementKey = parentname + '_' + schemaelement.element.name; - if (!$scope.callFromMap) { - elementKeys.push(elementKey); - } else { - if ($scope.oldMapValFlag) { - $scope.oldmappedvaluesArray - .push(schemaelement.element.name); - $scope.oldMappedvaluesKeyArray.push(elementKey); - } else { - $scope.newMappedvaluesArray - .push(schemaelement.element.name); - $scope.newMappedvaluesKeyArray.push(elementKey); - } - } - } - if (schemaelement.type != null - && schemaelement.type.complexType != null) { - var parentkey = parentname + '_' + schemaelement.element.name; - for (var i = 0; i < schemaelement.type.elements.length; i++) { - getElementkeys(parentkey, schemaelement.type.elements[i]); - } - } - } -} ]); diff --git a/src/main/resources/META-INF/resources/designer/scripts/app.js b/src/main/resources/META-INF/resources/designer/scripts/app.js index 59a27bdfe..b0b34533a 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/app.js +++ b/src/main/resources/META-INF/resources/designer/scripts/app.js @@ -678,7 +678,7 @@ function($scope, $rootScope, $timeout, dialogs) { var dlg = dialogs.create( 'partials/portfolios/PolicyWindow_properties.html', - 'ImportSchemaCtrl', { + 'operationalPolicyCtrl', { closable : true, draggable : true }, { @@ -768,18 +768,7 @@ app.run([ '$route', function($route) { $route.reload(); } ]); -function TestCtrl($scope) { - $scope.msg = "Hello from a controller method."; - $scope.returnHello = function() { - - return $scope.msg; - } -} -function importshema() { - - angular.element(document.getElementById('navbar')).scope().importSchema(); -} function F5Window() { angular.element(document.getElementById('navbar')).scope().F5Window(); @@ -790,7 +779,7 @@ function GOCWindow() { } function ToscaModelWindow() { angular.element(document.getElementById('navbar')).scope().ToscaModelWindow(); -}; +} function PolicyWindow(PolicyWin) { angular.element(document.getElementById('navbar')).scope().PolicyWindow( @@ -806,23 +795,11 @@ function setdefaultvalue() { angular.element(document.getElementById('navbar')).scope() .setDefaultValue(); } -function upgradeSchemaVersion() { - - angular.element(document.getElementById('navbar')).scope() - .upgradeSchemaVersion(); -} function saveProject() { angular.element(document.getElementById('navbar')).scope().saveProject(); } -function modifySchema() { - angular.element(document.getElementById('navbar')).scope().modifySchema(); -} -function definePID() { - - angular.element(document.getElementById('navbar')).scope().definePID(); -} function defineServiceAcronym() { angular.element(document.getElementById('navbar')).scope() diff --git a/src/main/resources/META-INF/resources/designer/scripts/common_variables.js b/src/main/resources/META-INF/resources/designer/scripts/common_variables.js index 826e1870e..36070de59 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/common_variables.js +++ b/src/main/resources/META-INF/resources/designer/scripts/common_variables.js @@ -30,7 +30,6 @@ var list_model_test_sets={}; var list_model_path_details={}; var list_model_schema_extensions={}; var list_model_test_management_details={}; -var isImportSchema=false; var selected_decison_element=''; var selected_element_name = ''; var list_model_repeatable_heirarchical_elements={}; diff --git a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js index 044b21eca..f1ab1e195 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js +++ b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js @@ -21,20 +21,20 @@ * */ -function updateMsProperties(type, form) { +function updateMsProperties(type, newMsProperties) { var newMsProperties = cl_props["microServicePolicies"]; for (p in newMsProperties) { if (newMsProperties[p]["name"] == type) { - cl_props["microServicePolicies"][p] = form; + cl_props["microServicePolicies"][p] = newMsProperties; } } } -function updateGlobalProperties(form) { - cl_props["globalPropertiesJson"] = form; +function updateGlobalProperties(newGlobalProperties) { + cl_props["globalPropertiesJson"] = newGlobalProperties; } -function updateOpPolicyProperties(form) { +function updateOpPolicyProperties(newOpProperties) { cl_props["operationalPolicies"] = newOpProperties; } diff --git a/src/main/resources/META-INF/resources/designer/scripts/soapRequestService.js b/src/main/resources/META-INF/resources/designer/scripts/soapRequestService.js deleted file mode 100644 index 25a0b4788..000000000 --- a/src/main/resources/META-INF/resources/designer/scripts/soapRequestService.js +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -app.service('soapRequestService', ['$http', '$q', function ($http, $q) { - console.log("////////////soapRequestService"); - this.changetimeoutMode = function(timeoutMode){ - console.log("changetimeoutMode"); - console.log("timeoutmode:"+timeoutMode); - if(timeoutMode == "Default") - return false; - else - return true; - }; - - - this.generateTst = function(tstInput, generateTSTUrl){ - console.log("generateTst"); - var def = $q.defer(); - - $http.post(generateTSTUrl, tstInput) - .success(function(data){ - console.log("success"); - def.resolve(data); - - }) - .error(function(data){ - console.log("error"); - def.reject("GenerateTST not successful"); - }); - - return def.promise; - }; - - - this.generateTSTMultiple = function(tstInputList, generateTSTUrl){ - console.log("generateTSTMultiple"); - var def = $q.defer(); - - $http.post(generateTSTUrl, tstInputList) - .success(function(data){ - console.log("success"); - def.resolve(data); - - }) - .error(function(data){ - console.log("error"); - def.reject("GenerateTST multiple not successful"); - }); - - return def.promise; - }; - - this.downloadTst = function(tstId, tstName,downloadTSTUrl){ - console.log("downloadTst"); - var def = $q.defer(); - - var downloadInput={}; - - downloadInput.tstId=tstId; - downloadInput.tstName=tstName; - - $http({ - url: downloadTSTUrl, method: "POST", data: downloadInput, - responseType: 'arraybuffer' }).success(function (data, status, headers, config) { - console.log("success"); - var results = []; - - - results.data = new Blob([data], {type: 'application/octet-stream'}); - console.log( results.data); - results.headers = headers(); - results.status = status; - results.config = config; - def.resolve(results); - console.log( "Result From UTM Server : " + results.data); - }) - .error(function(data){ - console.log("error"); - def.reject("DownloadTST not successful"); - }); - - return def.promise; - }; - -}]); |