diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2017-08-08 03:11:34 -0700 |
---|---|---|
committer | Sébastien Determe <sd378r@intl.att.com> | 2017-08-08 12:36:02 +0000 |
commit | c5a577a1cc00ace7964ff53dd2862a7dd2325411 (patch) | |
tree | 09212dfa0e3bed68f26337918aa48d7da194a98c | |
parent | a1171303f4017991cf4e41fd2202d8e165b70732 (diff) |
Rework javascripts for designer UI (part2)
Rework javascripts for designer UI (part2)
Change-Id: I72ffef0adc2559e8053203cee928eff5c4d9b0dc
Issue-Id: CLAMP-1
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
9 files changed, 406 insertions, 670 deletions
diff --git a/src/main/resources/META-INF/resources/designer/scripts/AutosaveProjectCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/AutosaveProjectCtrl.js index 02297d7a..0c3fd2ed 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/AutosaveProjectCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/AutosaveProjectCtrl.js @@ -24,102 +24,4 @@ function AutosaveProject($scope,$rootScope,$resource, $http, $timeout, $location, $interval, $q, Datafactory) { console.log("//////////Autosaveproject"); - $scope.saveProjectToUrl = function(UTMMDTProject,svnUploadURL){ - console.log("saveProjectURL"); - console.log('Autosaveproject Enter == ' + new Date().getTime()); - console.log(new Date()); - var def = $q.defer(); - - $http.post(svnUploadURL, UTMMDTProject) - .success(function(data){ - console.log("success"); - def.resolve(data); - }) - .error(function(data){ - console.log("error"); - def.reject("Autosave unsuccessful"); - }); - - return def.promise; - - }; - - $scope.autosave = function(){ - console.log("autosave"); - - var saveProjectURL = "/utm-service/project_administration/autoSaveProject"; - - var UTMProjectExplorer = {}; - UTMProjectExplorer.projectName = $rootScope.projectName; - UTMProjectExplorer.utmModels = $rootScope.utmModels; - UTMProjectExplorer.revision = autoSaveRevision; - UTMProjectExplorer.utmDepthValueMap = $rootScope.depthElementKeyMap; - UTMProjectExplorer.utmCountValueMap = $rootScope.countElementKeyMap; - - var utm_models = []; - $rootScope.populateUTMModelArray(utm_models,$rootScope.utmModels); - - var UTMMDTProject = {}; - UTMMDTProject.utmProjectExplorer = UTMProjectExplorer; - UTMMDTProject.utmModels = utm_models; - UTMMDTProject.almqcdata = $rootScope.almqcData; - UTMMDTProject.wsdlInfo = null; - UTMMDTProject.schemaLocation = null; - - if ($rootScope.wsdlInfo != null) { - UTMMDTProject.schemaLocation = $rootScope.wsdlInfo.schemaLocation; - UTMMDTProject.oldSchemaLocation = $rootScope.wsdlInfo.oldSchemaLocation; - UTMMDTProject.schemaUpgradedFlag = $rootScope.wsdlInfo.schemaUpgradedFlag; - } - - UTMMDTProject.revision=$rootScope.revision; - console.log(UTMMDTProject.revision); - - UTMMDTProject.checkOutPath=$rootScope.checkOutPath; - UTMMDTProject.oldNewModelNameMap = old_new_model_name; - UTMMDTProject.automationDetails={}; - - UTMMDTProject.automationDetails.projectPreferenceInfo = Datafactory.getProjectPreferenceInfo(); - UTMMDTProject.automationDetails.environmentData = $rootScope.environmentData; - UTMMDTProject.automationDetails.pythonScriptList = Datafactory.getCommonPythonScriptList(); - UTMMDTProject.automationDetails.dbToolRequestList = Datafactory.getDbToolProjectLevelList(); - UTMMDTProject.automationDetails.runtimePythonScriptList = Datafactory.getRuntimePythonScriptProjectLevelList(); - UTMMDTProject.automationDetails.xmlValidatorList = Datafactory.getXmlValidatorList(); - UTMMDTProject.automationDetails.fileWriterList = Datafactory.getWriteFileDataList(); - UTMMDTProject.automationDetails.fileStreamWriterList = Datafactory.getFileStreamWriterList(); - - - - if($rootScope.openedProject != null){ - console.log('opened project...') - var existingData = JSON.stringify($rootScope.openedProject); - var currentgData = JSON.stringify(UTMMDTProject); - if(angular.equals(existingData, currentgData)){ - //do nothing - console.log('No changes found.'); - }else{ - console.log('Changes found.'); - $scope.saveProjectToUrl(UTMMDTProject,saveProjectURL) - .then(function(pars) { - console.log(""); - }, - function(data) { - - }); - } - - }else{ - console.log('autosaving project...') - $scope.saveProjectToUrl(UTMMDTProject,saveProjectURL) - .then(function(pars) { - - }, - function(data) { - - }); - } - - } - - $scope.autosave(); } diff --git a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js index c0d4f8a7..c2b4f673 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js +++ b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js @@ -22,253 +22,282 @@ */ app.service('cldsModelService', ['alertService','$http', '$q', function (alertService,$http, $q) { - console.log("/////////////cldsModelService"); - function checkIfElementType(name){ + + function checkIfElementType(name){ - //This will open the methods located in the app.js - if(name.toLowerCase().indexOf("stringmatch")>=0) - StringMatchWindow(); - else if(name.toLowerCase().indexOf("tca")>=0) - TCAWindow(); - else if(name.toLowerCase().indexOf("collector")>=0) - CollectorsWindow(); - else if(name.toLowerCase().indexOf("policy")>=0) - PolicyWindow(); - - } - this.getASDCServices = function(){ - - console.log("getASDCServices"); - var def = $q.defer(); - var sets = []; - - var svcUrl = "/restservices/clds/v1/clds/asdc/services/"; - + //This will open the methods located in the app.js + if (name.toLowerCase().indexOf("stringmatch")>=0) + StringMatchWindow(); + else if (name.toLowerCase().indexOf("tca")>=0) + TCAWindow(); + else if(name.toLowerCase().indexOf("policy")>=0) + PolicyWindow(); + else if(name.toLowerCase().indexOf("collector")>=0) + CollectorsWindow(); + + } + + this.toggleDeploy = function (uiAction, modelName, controlNamePrefixIn, + bpmnTextIn, propTextIn, svgXmlIn, templateName, typeID, controlNameUuid, modelEventService, deploymentId) { + + var def = $q.defer(); + var sets = []; + var action = uiAction.toLowerCase(); + var deployUrl = "/restservices/clds/v1/clds/"+action+"/"+modelName; + var requestData = {name: modelName, + controlNamePrefix: controlNamePrefixIn, + bpmnText: bpmnTextIn, + propText: propTextIn, + imageText:svgXmlIn, + templateName:templateName, + typeId:typeID, + controlNameUuid: controlNameUuid, + event:modelEventService, + deploymentId:deploymentId}; + + $http.put(deployUrl,requestData) + .success(function(data){ + deploymentId = data.deploymentId; + def.resolve(data); + alertService.alertMessage("Action Successful:"+uiAction,1) + }) + .error(function(data){ + alertService.alertMessage("Action Failure:"+uiAction,2) + def.reject("Save Model not successful"); + }); + + return def.promise; + }; + + this.getASDCServices = function(){ + + + var def = $q.defer(); + var sets = []; + + var svcUrl = "/restservices/clds/v1/clds/sdc/services/"; + $http.get(svcUrl) - .success(function(data){ - def.resolve(data); - - + .success(function(data){ + def.resolve(data); + + }) - .error(function(data){ - def.reject("Asdc Services not found"); - + .error(function(data){ + def.reject("sdc Services not found"); + }); return def.promise; }; - this.getRunningInstances=function(resouseInput){ - console.log("getRunningInstances"); - var def = $q.defer(); - var sets = []; - - //Look in scripts/common_variables.html to get utmModel name - - // var svcUrl = "/restservices/clds/v1/clds/model/roncl003"; - var svcUrl = "/restservices/clds/v1/clds/model/" + resouseInput; - - $http.get(svcUrl) - .success(function(data){ - def.resolve(data); - - - }) - .error(function(data){ - def.reject("Asdc Services not found"); - - }); - - return def.promise; - - // return [{"name":"asbg0003vm001","location":"SNANTXCA","status":"Running","view":"KPI"},{"name":"asbg0003vm002","location":"SNANTXCA","status":"Running","view":"KPI"},{"name":"asbg0003vm003","location":"SNANTXCA","status":"Running","view":"KPI"},{"name":"asbg0003vm004","location":"SNANTXCA","status":"Stopped","view":"KPI"}] - } this.getASDCService = function(uuid){ - console.log("getASDCService"); - - var def = $q.defer(); - var sets = []; - - var svcUrl = "/restservices/clds/v1/clds/asdc/services/" + uuid; - + + + var def = $q.defer(); + var sets = []; + + var svcUrl = "/restservices/clds/v1/clds/sdc/services/" + uuid; + $http.get(svcUrl) .success(function(data){ - def.resolve(data); - + def.resolve(data); + }) - .error(function(data){ - def.reject("ASDC service not found"); + .error(function(data){ + def.reject("SDC service not found"); }); return def.promise; }; this.getModel = function(modelName){ - - console.log("getModel"); - var def = $q.defer(); - var sets = []; - - var svcUrl = "/restservices/clds/v1/clds/model/" + modelName; - + + + var def = $q.defer(); + var sets = []; + var svcUrl = "/restservices/clds/v1/clds/model/" + modelName; + $http.get(svcUrl) - .success(function(data){ - def.resolve(data); - + .success(function(data){ + def.resolve(data); + }) - .error(function(data){ - def.reject("Open Model not successful"); + .error(function(data){ + def.reject("Open Model not successful"); }); return def.promise; }; this.getSavedModel=function(){ - console.log("getSavedModel"); - var def = $q.defer(); - var sets = []; - - var svcUrl = "/restservices/clds/v1/clds/model-names"; - + + var def = $q.defer(); + var sets = []; + + var svcUrl = "/restservices/clds/v1/clds/model-names"; + $http.get(svcUrl) - .success(function(data){ - def.resolve(data); - + .success(function(data){ + def.resolve(data); + }) - .error(function(data){ - def.reject("Open Model not successful"); + .error(function(data){ + def.reject("Open Model not successful"); }); return def.promise; }; this.setModel = function(modelName, controlNamePrefixIn, bpmnTextIn, propTextIn){ - - console.log("setModel"); - var def = $q.defer(); - var sets = []; - - var svcUrl = "/restservices/clds/v1/clds/model/" + modelName; + + + var def = $q.defer(); + var sets = []; + var svcUrl = "/restservices/clds/v1/clds/model/" + modelName; var svcRequest = {name: modelName, controlNamePrefix: controlNamePrefixIn, bpmnText: bpmnTextIn, propText: propTextIn}; - + $http.put(svcUrl, svcRequest) - .success(function(data){ - def.resolve(data); - + .success(function(data){ + def.resolve(data); + }) - .error(function(data){ - def.reject("Save Model not successful"); + .error(function(data){ + def.reject("Save Model not successful"); }); return def.promise; }; - this.processAction = function(uiAction, modelName, controlNamePrefixIn, bpmnTextIn, propTextIn,svgXmlIn,templateName){ - - console.log("processAction"); - var def = $q.defer(); - var sets = []; - console.log("Generated SVG xml File..."); - //console.log(svgXmlIn); - var svcUrl = "/restservices/clds/v1/clds/"; - var svcAction = uiAction.toLowerCase(); - if ( svcAction == "save" || svcAction == "refresh" ) { - svcUrl = svcUrl + "model/" + modelName; - } else if ( svcAction == "test" ) { - svcUrl = svcUrl + "action/submit/" + modelName + "?test=true"; - } else { - svcUrl = svcUrl + "action/" + svcAction + "/" + modelName; - } - - var svcRequest = {name: modelName, controlNamePrefix: controlNamePrefixIn, bpmnText: bpmnTextIn, propText: propTextIn, imageText:svgXmlIn, templateName:templateName}; - console.log(svcRequest) + this.processAction = function(uiAction, modelName, controlNamePrefixIn, bpmnTextIn, propTextIn,svgXmlIn,templateName,typeID,deploymentId){ + + + var def = $q.defer(); + var sets = []; + + //console.log(svgXmlIn); + var svcUrl = "/restservices/clds/v1/clds/"; + var svcAction = uiAction.toLowerCase(); + if ( svcAction == "save" || svcAction == "refresh" ) { + svcUrl = svcUrl + "model/" + modelName; + } else if ( svcAction == "test" ) { + svcUrl = svcUrl + "action/submit/" + modelName + "?test=true"; + } else { + svcUrl = svcUrl + "action/" + svcAction + "/" + modelName; + } + + var svcRequest = {name: modelName, controlNamePrefix: controlNamePrefixIn, bpmnText: bpmnTextIn, propText: propTextIn, imageText:svgXmlIn, templateName:templateName, typeId:typeID, deploymentId:deploymentId}; + $http.put(svcUrl, svcRequest) .success(function(data){ - def.resolve(data); - alertService.alertMessage("Action Successful:"+uiAction,1) - + def.resolve(data); + alertService.alertMessage("Action Successful:"+uiAction,1) + }) .error(function(data){ - alertService.alertMessage("Action Failure:"+uiAction,2); - //def alertService.alertMessage("Action Successful:"+uiAction,1); - def.reject(svcAction + " not successful"); + alertService.alertMessage("Action Failure:"+uiAction,2); + //def alertService.alertMessage("Action Successful:"+uiAction,1); + def.reject(svcAction + " not successful"); + }); + + return def.promise; + }; + this.manageAction = function(modelName,typeId,typeName){ + var def = $q.defer(); + var sets = []; + + var config = { + url: "/restservices/clds/v1/clds/getDispatcherInfo", + method: "GET", + params:{model:modelName,typeId:typeId,typeName:typeName} + }; + $http(config) + .success(function(data){ + def.resolve(data); + + }) + .error(function(data){ + def.reject("manage action not successful"); }); return def.promise; + }; this.checkPermittedActionCd = function(permittedActionCd, menuText, actionCd){ - console.log("checkPermittedActionCd"); - if ( permittedActionCd.indexOf(actionCd) > -1 ) { - document.getElementById(menuText).classList.remove('ThisLink'); - } else { - document.getElementById(menuText).classList.add('ThisLink'); - } + if ( permittedActionCd.indexOf(actionCd) > -1 ) { + document.getElementById(menuText).classList.remove('ThisLink'); + } else { + document.getElementById(menuText).classList.add('ThisLink'); + } }; this.processActionResponse = function(modelName, pars){ - console.log("processActionResponse"); - // populate control name (prefix and uuid here) - var controlNamePrefix = pars.controlNamePrefix; - var controlNameUuid = pars.controlNameUuid; - - + + // populate control name (prefix and uuid here) + var controlNamePrefix = pars.controlNamePrefix; + var controlNameUuid = pars.controlNameUuid; + deploymentId = pars.deploymentId; + var modelEventService = pars.modelEventService; + typeID = pars.typeId; - var headerText = "Closed Loop Modeler - " + modelName; + var headerText = "Closed Loop Modeler - " + modelName; if ( controlNameUuid != null ) { - var actionCd = pars.event.actionCd; - var actionStateCd = pars.event.actionStateCd; - //headerText = headerText + " [" + controlNamePrefix + controlNameUuid + "] [" + actionCd + ":" + actionStateCd + "]"; - headerText = headerText + " [" + controlNamePrefix + controlNameUuid + "]"; - console.log("MINA PARS TEST " + headerText + " ----- " + controlNamePrefix + " ----- " + controlNameUuid + " ----- " + pars); + var actionCd = pars.event.actionCd; + var actionStateCd = pars.event.actionStateCd; + //headerText = headerText + " [" + controlNamePrefix + controlNameUuid + "] [" + actionCd + ":" + actionStateCd + "]"; + headerText = headerText + " [" + controlNamePrefix + controlNameUuid + "]"; } - - document.getElementById("modeler_name").textContent = headerText; - setStatus(pars) - disableBPMNAddSVG(pars); + + document.getElementById("modeler_name").textContent = headerText; + document.getElementById("templa_name").textContent = ("Template Used - " + selected_template); + setStatus(pars) + disableBPMNAddSVG(pars); this.enableDisableMenuOptions(pars); - - + + }; this.processRefresh=function(pars){ - console.log("processRefresh"); - setStatus(pars); + typeID = pars.typeId; + deploymentId = pars.deploymentId; + setStatus(pars); + this.enableDisableMenuOptions(pars); } function setStatus(pars){ - console.log("setStatus"); - var status = pars.status; - // apply color to status - var statusColor='white'; - if(status.trim()==="DESIGN"){ - statusColor='gray' - } else if(status.trim()==="DISTRIBUTED"){ - statusColor='blue' - } else if(status.trim()==="ACTIVE"){ - statusColor='green' - } else if(status.trim()==="STOPPED"){ - statusColor='red' - } else if(status.trim()==="DELETING"){ - statusColor='pink' - } else if(status.trim()==="ERROR"){ - statusColor='orange' - } else if(status.trim()==="UNKNOWN"){ - statusColor='blue' - } else{ - statusColor=null; - } - + + var status = pars.status; + // apply color to status + var statusColor='white'; + if(status.trim()==="DESIGN"){ + statusColor='gray' + } else if(status.trim()==="DISTRIBUTED"){ + statusColor='blue' + } else if(status.trim()==="ACTIVE"){ + statusColor='green' + } else if(status.trim()==="STOPPED"){ + statusColor='red' + } else if(status.trim()==="DELETING"){ + statusColor='pink' + } else if(status.trim()==="ERROR"){ + statusColor='orange' + } else if(status.trim()==="UNKNOWN"){ + statusColor='blue' + } else{ + statusColor=null; + } + - var statusMsg='<span style="background-color:' + statusColor + ';-moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px;"> '+status+' </span>'; - // display status - if ($("#status_clds").length>=1) - $("#status_clds").remove(); - $("#activity_modeler").append('<span id="status_clds" style="position: absolute; left: 61%;top: 51px; font-size:20px;">Status: '+statusMsg+'</span>'); + var statusMsg='<span style="background-color:' + statusColor + ';-moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px;"> '+status+' </span>'; + // display status + if ($("#status_clds").length>=1) + $("#status_clds").remove(); + $("#activity_modeler").append('<span id="status_clds" style="position: absolute; left: 61%;top: 51px; font-size:20px;">Status: '+statusMsg+'</span>'); - + } function disableBPMNAddSVG(pars){ - console.log("disableBPMNAddSVG"); - var svg=pars.imageText.substring(pars.imageText.indexOf("<svg")) - if($("#svgContainer").length>0) - $("#svgContainer").remove(); - $("#js-canvas").append("<span id=\"svgContainer\">"+svg+"</span>"); + + var svg=pars.imageText.substring(pars.imageText.indexOf("<svg")) + if($("#svgContainer").length>0) + $("#svgContainer").remove(); + $("#js-canvas").append("<span id=\"svgContainer\">"+svg+"</span>"); /* added code for height width viewBox */ $("#svgContainer svg").removeAttr("height"); $("#svgContainer svg").removeAttr('viewBox'); @@ -277,50 +306,74 @@ this.getASDCService = function(uuid){ $("#svgContainer svg").attr('width','100%'); $("#svgContainer svg").attr('height','100%'); - $("#svgContainer").click(function(event){ - console.log($(event.target).parent().html()) - console.log($($(event.target).parent()).attr("data-element-id")) - var name=$($(event.target).parent()).attr("data-element-id") - lastElementSelected=$($(event.target).parent()).attr("data-element-id") - checkIfElementType(name) - - }) + $("#svgContainer").click(function(event){ + //console.log($(event.target).parent().html()) + //console.log($($(event.target).parent()).attr("data-element-id")) + var name=$($(event.target).parent()).attr("data-element-id") + lastElementSelected=$($(event.target).parent()).attr("data-element-id") + checkIfElementType(name) + + }) $(".bjs-container").attr("hidden",""); } this.enableDisableMenuOptions=function(pars){ - console.log("enableDisableMenuOptions"); - var permittedActionCd = pars.permittedActionCd; - // enable menu options - document.getElementById('Save CL').classList.remove('ThisLink'); - document.getElementById('Test').classList.remove('ThisLink'); - document.getElementById('Properties CL').classList.remove('ThisLink'); - document.getElementById('Refresh Status').classList.remove('ThisLink'); - document.getElementById('Revert Model Changes').classList.remove('ThisLink'); - document.getElementById('Close Model').classList.remove('ThisLink'); - document.getElementById('Refresh ASDC').classList.remove('ThisLink'); - document.getElementById('Running Instances').classList.remove('ThisLink'); - - //disable template options for save/properties - document.getElementById('Save Template').classList.add('ThisLink'); - document.getElementById('Template Properties').classList.add('ThisLink'); - document.getElementById('Revert Template Changes').classList.add('ThisLink'); - document.getElementById('Close Template').classList.add('ThisLink'); - - - // enable/disable menu options based on permittedActionCd list - this.checkPermittedActionCd(permittedActionCd, 'Submit', 'SUBMIT'); - this.checkPermittedActionCd(permittedActionCd, 'Resubmit', 'RESUBMIT'); - this.checkPermittedActionCd(permittedActionCd, 'Update', 'UPDATE'); - this.checkPermittedActionCd(permittedActionCd, 'Delete', 'DELETE'); - this.checkPermittedActionCd(permittedActionCd, 'Stop', 'STOP'); - this.checkPermittedActionCd(permittedActionCd, 'Restart', 'RESTART'); - } + + var permittedActionCd = pars.permittedActionCd; + + //dropdown options - always true + document.getElementById('Open Template').classList.remove('ThisLink'); + document.getElementById('Open CL').classList.remove('ThisLink'); + document.getElementById('Save Template').classList.add('ThisLink'); + document.getElementById('Template Properties').classList.add('ThisLink'); + document.getElementById('Revert Template Changes').classList.add('ThisLink'); + document.getElementById('Close Template').classList.add('ThisLink'); + + if (readOnly||readMOnly){ + //enable model options + document.getElementById('Properties CL').classList.remove('ThisLink'); + document.getElementById('Close Model').classList.remove('ThisLink'); + + //disable models options + document.getElementById('Create CL').classList.add('ThisLink'); + document.getElementById('Save CL').classList.add('ThisLink'); + document.getElementById('Revert Model Changes').classList.add('ThisLink'); + } else { + // enable menu options + document.getElementById('Create CL').classList.remove('ThisLink'); + document.getElementById('Save CL').classList.remove('ThisLink'); + document.getElementById('Properties CL').classList.remove('ThisLink'); + document.getElementById('Revert Model Changes').classList.remove('ThisLink'); + document.getElementById('Close Model').classList.remove('ThisLink'); + + + document.getElementById('Validation Test').classList.remove('ThisLink'); + document.getElementById('Refresh Status').classList.remove('ThisLink'); + document.getElementById('Refresh ASDC').classList.remove('ThisLink'); + } + if (readTOnly){ + document.getElementById('Create Template').classList.add('ThisLink'); + } else { + document.getElementById('Create Template').classList.remove('ThisLink'); + } + + // enable/disable menu options based on permittedActionCd list + this.checkPermittedActionCd(permittedActionCd, 'Validation Test', 'TEST'); + this.checkPermittedActionCd(permittedActionCd, 'Submit', 'SUBMIT'); + this.checkPermittedActionCd(permittedActionCd, 'Resubmit', 'RESUBMIT'); + this.checkPermittedActionCd(permittedActionCd, 'Update', 'UPDATE'); + this.checkPermittedActionCd(permittedActionCd, 'Stop', 'STOP'); + this.checkPermittedActionCd(permittedActionCd, 'Restart', 'RESTART'); + this.checkPermittedActionCd(permittedActionCd, 'Delete', 'DELETE'); + this.checkPermittedActionCd(permittedActionCd, 'Deploy', 'DEPLOY'); + this.checkPermittedActionCd(permittedActionCd, 'UnDeploy', 'UNDEPLOY'); + + } this.getASDCServices().then(function(pars){ - console.log("getASDCServices"); - var services=pars.service; - asdc_Services=services + + var services=pars.service; + asdc_Services=services }); }]); diff --git a/src/main/resources/META-INF/resources/designer/scripts/CldsOpenModelCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/CldsOpenModelCtrl.js index d58dcb92..f31d72e5 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/CldsOpenModelCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/CldsOpenModelCtrl.js @@ -20,11 +20,10 @@ * =================================================================== * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ - app.controller('CldsOpenModelCtrl', ['$scope', '$rootScope', '$modalInstance','cldsModelService', '$location', 'dialogs','cldsTemplateService', function($scope, $rootScope, $modalInstance, cldsModelService, $location,dialogs,cldsTemplateService) { - console.log("/////////CldsOpenModelCtrl"); + $scope.typeModel='template'; $scope.error = { flag : false, @@ -38,7 +37,6 @@ app.controller('CldsOpenModelCtrl', $scope.modelNamel.push(pars[i].value); } setTimeout(function(){ - console.log("setTimeout"); setMultiSelect(); }, 100); @@ -69,7 +67,6 @@ app.controller('CldsOpenModelCtrl', } } $scope.refreshASDC=function(){ - console.log("refreshASDC"); $("#ridinSpinners").css("display","") var bool=loadSharedPropertyByService(undefined,true,callBack); $("#ridinSpinners").css("display","none"); @@ -78,17 +75,15 @@ app.controller('CldsOpenModelCtrl', } cldsTemplateService.getSavedTemplate().then(function(pars) { - - $scope.templateNamel=[] for(var i=0;i<pars.length;i++){ $scope.templateNamel.push(pars[i].value); - } - + setTimeout(function(){ + setMultiSelect();}, 100); }); + function contains(a, obj) { - console.log("contains"); var i = a&& a.length>0 ? a.length : 0; while (i--) { if (a[i].toLowerCase() === obj.toLowerCase()) { @@ -98,7 +93,6 @@ app.controller('CldsOpenModelCtrl', return false; } $scope.checkExisting=function(){ - console.log("checkExisting"); var name = $('#modelName').val(); if(contains($scope.modelNamel,name)){ $scope.nameinUse=true; @@ -108,7 +102,6 @@ app.controller('CldsOpenModelCtrl', specialCharacters(); } function specialCharacters (){ - console.log("specialCharacters"); $scope.spcl = false; if(angular.element("#modelName") && angular.element("#modelName").scope().model.$error.pattern && @@ -119,23 +112,18 @@ app.controller('CldsOpenModelCtrl', $scope.setTypeModel=function(_type){ $scope.error.flag = false; - console.log("setTypeModel"); $scope.typeModel=_type; } $scope.close = function(){ - console.log("close"); $rootScope.isNewClosed = false; $modalInstance.close("closed"); }; $scope.createNewModelOffTemplate=function(formModel){ - console.log("createNewModelOffTemplate"); - console.log(formModel); reloadDefaultVariables(false) var modelName = document.getElementById("modelName").value; var templateName=document.getElementById("templateName").value; - console.log("openModel: modelName=" + modelName); - console.log("Template: templateName=" + templateName); + if(!modelName){ $scope.error.flag =true; $scope.error.message = "Please enter any closed template name for proceeding"; @@ -155,20 +143,24 @@ app.controller('CldsOpenModelCtrl', cldsTemplateService.getTemplate( templateName ).then(function(pars) { - console.log("openModel: pars=" + pars); var tempImageText=pars.imageText var bpmnText=pars.bpmnText + var authorizedToUp = pars.userAuthorizedToUpdate; pars={} pars.imageText=tempImageText pars.status= "DESIGN"; - pars.permittedActionCd= ["SUBMIT"]; - cldsModelService.processActionResponse(modelName, pars); - + if (readOnly || readMOnly){ + pars.permittedActionCd=[""]; + } else { + pars.permittedActionCd=["TEST", "SUBMIT"]; + } selected_template= templateName selected_model = modelName; + + cldsModelService.processActionResponse(modelName, pars); // set model bpmn and open diagram $rootScope.isPalette = true; @@ -178,17 +170,16 @@ app.controller('CldsOpenModelCtrl', function(data) { //alert("getModel failed"); }); - + allPolicies = {}; + elementMap = {}; $modalInstance.close("closed"); } $scope.cloneModel=function(){ - console.log("cloneModel"); reloadDefaultVariables(false) var modelName = document.getElementById("modelName").value; var originalModel=document.getElementById("modelList").value; - console.log("openModel: modelName=" + modelName); if(!modelName){ $scope.error.flag =true; $scope.error.message = "Please enter any name for proceeding"; @@ -209,7 +200,6 @@ app.controller('CldsOpenModelCtrl', cldsModelService.getModel( originalModel ).then(function(pars) { - console.log("openModel: pars=" + pars); // process data returned var bpmnText = pars.bpmnText; @@ -218,15 +208,26 @@ app.controller('CldsOpenModelCtrl', var controlNamePrefix = pars.controlNamePrefix; var controlNameUuid = pars.controlNameUuid; selected_template=pars.templateName; + typeID = pars.typeId; pars.status="DESIGN"; + if (readOnly || readMOnly){ + pars.permittedActionCd=[""]; + } else { + pars.permittedActionCd=["TEST", "SUBMIT"]; + } pars.controlNameUuid=""; + modelEventService = pars.event; + //actionCd = pars.event.actionCd; + actionStateCd = pars.event.actionStateCd; + deploymentId = pars.deploymentId; + + var authorizedToUp = pars.userAuthorizedToUpdate; + cldsModelService.processActionResponse(modelName, pars); // deserialize model properties if ( propText == null ) { - console.log("openModel: propText is null"); } else { - console.log("openModel: propText=" + propText); elementMap = JSON.parse(propText); } @@ -244,10 +245,8 @@ app.controller('CldsOpenModelCtrl', $modalInstance.close("closed"); } $scope.createNewModel=function(){ - console.log("createNewModel"); reloadDefaultVariables(false) - var modelName = document.getElementById("modelName").value; - console.log("openModel: modelName=" + modelName); + var modelName = document.getElementById("modelName").value; // BEGIN env // init UTM items @@ -263,7 +262,7 @@ app.controller('CldsOpenModelCtrl', $rootScope.utmModels = utmModels; // enable appropriate menu options - var pars = {status: "DESIGN", permittedActionCd: ["SUBMIT"]}; + var pars = {status: "DESIGN"}; cldsModelService.processActionResponse(modelName, pars); @@ -297,21 +296,14 @@ app.controller('CldsOpenModelCtrl', $modalInstance.close("closed"); } $scope.revertChanges=function(){ - console.log("revertChanges"); $scope.openModel(); } $scope.openModel = function(){ - console.log("openModel"); reloadDefaultVariables(false) - var readonly; if(document.getElementById("readOnly")){ - readOnly=document.getElementById("readOnly").checked; + readOnly=document.getElementById("readOnly").checked; } - - console.log("readonly seen ") - console.log(readOnly) - var modelName = document.getElementById("modelName").value; - console.log("openModel: modelName=" + modelName); + var modelName = document.getElementById("modelName").value; // init UTM items $scope.utmModelsArray = []; @@ -325,24 +317,30 @@ app.controller('CldsOpenModelCtrl', utmModels.subModels = []; $rootScope.utmModels = utmModels; - cldsModelService.getModel( modelName ).then(function(pars) { - console.log("openModel: pars=" + pars); - console.log(pars) // process data returned var bpmnText = pars.bpmnText; var propText = pars.propText; var status = pars.status; - var controlNamePrefix = pars.controlNamePrefix; - var controlNameUuid = pars.controlNameUuid; - selected_template=pars.templateName + controlNamePrefix = pars.controlNamePrefix; + // var controlNameUuid = pars.controlNameUuid; + var authorizedToUp = pars.userAuthorizedToUpdate; + typeID = pars.typeId; + controlNameUuid = pars.controlNameUuid; + selected_template=pars.templateName; + modelEventService = pars.event; + //actionCd = pars.event.actionCd; + actionStateCd = pars.event.actionStateCd; + deploymentId = pars.deploymentId; + + if (readMOnly || readOnly){ + pars.permittedActionCd= [""]; + } cldsModelService.processActionResponse(modelName, pars); // deserialize model properties if ( propText == null ) { - console.log("openModel: propText is null"); } else { - console.log("openModel: propText=" + propText); elementMap = JSON.parse(propText); } @@ -363,4 +361,4 @@ app.controller('CldsOpenModelCtrl', setMultiSelect(); } ] -); +);
\ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/scripts/CldsOpenTemplateCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/CldsOpenTemplateCtrl.js index bde63c91..32eb5c6a 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/CldsOpenTemplateCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/CldsOpenTemplateCtrl.js @@ -20,11 +20,10 @@ * =================================================================== * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ - app.controller('CldsOpenTemplateCtrl', ['$scope', '$rootScope', '$modalInstance','$window','cldsTemplateService', '$location', 'dialogs', function($scope, $rootScope, $modalInstance,$window, cldsTemplateService, $location,dialogs) { - console.log("////////////CldsOpenTemplateCtrl"); + $scope.error = { flag : false, message: "" @@ -39,14 +38,14 @@ app.controller('CldsOpenTemplateCtrl', //console.log($scope.modelNamel[i]) } setTimeout(function(){ - console.log("setTimeout"); + setMultiSelect(); }, 100); }); function contains(a, obj) { - console.log("contains"); + var i = a.length; while (i--) { if (a[i].toLowerCase() === obj.toLowerCase()) { @@ -56,7 +55,7 @@ app.controller('CldsOpenTemplateCtrl', return false; } $scope.checkExisting=function(){ - console.log("checkExisting"); + var name = $('#modelName').val(); //alert(name) //console.log($scope.modelNamel) @@ -69,14 +68,14 @@ app.controller('CldsOpenTemplateCtrl', } $scope.closeDiagram=function(){ - console.log("closeDiagram"); + $window.location.reload(); } $scope.createNewTemplate=function(){ - console.log("createNewTemplate"); + reloadDefaultVariables(true) if($(".bjs-container").is("[hidden]")){ $(".bjs-container").removeAttr("hidden"); @@ -87,9 +86,7 @@ app.controller('CldsOpenTemplateCtrl', $scope.error.flag =true; $scope.error.message = "Please enter any name for proceeding"; return false; - } - - console.log("openModel: modelName=" + modelName); + } // BEGIN env // init UTM items @@ -112,6 +109,7 @@ app.controller('CldsOpenTemplateCtrl', pars.event={} pars.event.actionStateCD="" pars.newTemplate = true + pars.permittedActionCd= [""]; cldsTemplateService.processActionResponse(modelName, pars); selected_model = modelName; @@ -145,23 +143,22 @@ app.controller('CldsOpenTemplateCtrl', } $scope.revertChanges=function(){ - console.log("revertChanges"); + $scope.openTemplate(); } $scope.close=function(){ - console.log("close"); + $rootScope.isNew = false; $modalInstance.close("closed"); } $scope.openTemplate = function() { - console.log("openTemplate"); + reloadDefaultVariables(true) if($(".bjs-container").is("[hidden]")){ $(".bjs-container").removeAttr("hidden"); $("#svgContainer").remove(); } var modelName = document.getElementById("modelName").value; - console.log("openModel: modelName=" + modelName); if($scope.modelNamel.includes(document.getElementById("modelName").value)){ } @@ -180,24 +177,19 @@ app.controller('CldsOpenTemplateCtrl', cldsTemplateService.getTemplate( modelName ).then(function(pars) { - console.log("openModel: pars="); - console.log(pars) // process data returned var bpmnText = pars.bpmnText; var propText = pars.propText; var status = pars.status; var controlNamePrefix = pars.controlNamePrefix; var controlNameUuid = pars.controlNameUuid; - + var authorizedToUp = pars.userAuthorizedToUpdate; + pars.permittedActionCd= [""]; cldsTemplateService.processActionResponse(modelName, pars); // deserialize model properties - console.log("prop text") - console.log(propText) if ( propText == null ) { - console.log("openModel: propText is null"); } else { - console.log("openModel: propText=" + propText); elementMap = JSON.parse(propText); } @@ -209,7 +201,7 @@ app.controller('CldsOpenTemplateCtrl', visibility_model(); }, function(data) { - console.log("data"); + //console.log("data"); //alert("getModel failed"); }); @@ -218,4 +210,4 @@ app.controller('CldsOpenTemplateCtrl', } ] -); +);
\ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/scripts/CldsTemplateService.js b/src/main/resources/META-INF/resources/designer/scripts/CldsTemplateService.js index 3d431386..a9ad8a3b 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/CldsTemplateService.js +++ b/src/main/resources/META-INF/resources/designer/scripts/CldsTemplateService.js @@ -24,7 +24,7 @@ app.service('cldsTemplateService', ['alertService', '$http', '$q', function (alertService, $http, $q) { this.getTemplate = function(templateName){ - console.log("///////////////cldsTemplateService"); + var def = $q.defer(); var sets = []; @@ -32,19 +32,19 @@ app.service('cldsTemplateService', ['alertService', '$http', '$q', function (ale $http.get(svcUrl) .success(function(data){ - console.log("success"); + def.resolve(data); }) .error(function(data){ - console.log("error"); + def.reject("Open Model not successful"); }); return def.promise; }; this.getSavedTemplate=function(){ - console.log("getSavedTemplate"); + var def = $q.defer(); var sets = []; @@ -52,12 +52,12 @@ app.service('cldsTemplateService', ['alertService', '$http', '$q', function (ale $http.get(svcUrl) .success(function(data){ - console.log("success"); + def.resolve(data); }) .error(function(data){ - console.log("error"); + def.reject("Open Model not successful"); }); @@ -65,7 +65,7 @@ app.service('cldsTemplateService', ['alertService', '$http', '$q', function (ale }; this.setTemplate = function(templateName, controlNamePrefixIn, bpmnTextIn, propTextIn){ - console.log("setTemplate"); + var def = $q.defer(); var sets = []; @@ -75,12 +75,12 @@ app.service('cldsTemplateService', ['alertService', '$http', '$q', function (ale $http.put(svcUrl, svcRequest) .success(function(data){ - console.log("success"); + def.resolve(data); }) .error(function(data){ - console.log("error"); + def.reject("Save Model not successful"); }); @@ -88,23 +88,21 @@ app.service('cldsTemplateService', ['alertService', '$http', '$q', function (ale }; this.processAction = function(uiAction, templateName, controlNamePrefixIn, bpmnTextIn, propTextIn,svgXmlIn){ - console.log("processAction"); + var def = $q.defer(); var sets = []; - console.log("Generated SVG xml File..."); - console.log(propTextIn); var svcUrl = "/restservices/clds/v1/cldsTempate/template/"+templateName; var svcRequest = {name: templateName, controlNamePrefix: controlNamePrefixIn, bpmnText: bpmnTextIn, propText: propTextIn, imageText:svgXmlIn}; $http.put(svcUrl, svcRequest) .success(function(data){ - console.log("success"); + def.resolve(data); alertService.alertMessage("Action Successful:"+uiAction,1) }) .error(function(data){ - console.log("error"); + def.reject(" not successful"); alertService.alertMessage("Action Failure:"+uiAction,2) @@ -113,7 +111,7 @@ app.service('cldsTemplateService', ['alertService', '$http', '$q', function (ale return def.promise; }; this.checkPermittedActionCd = function(permittedActionCd, menuText, actionCd){ - console.log("checkPermittedActionCd"); + if ( permittedActionCd.indexOf(actionCd) > -1 ) { document.getElementById(menuText).classList.remove('ThisLink'); } else { @@ -121,10 +119,11 @@ app.service('cldsTemplateService', ['alertService', '$http', '$q', function (ale } }; this.processActionResponse = function(templateName, pars){ - console.log("processActionResponse"); + // populate control name (prefix and uuid here) var controlNamePrefix = pars.controlNamePrefix; var controlNameUuid = pars.controlNameUuid; + var permittedActionCd = pars.permittedActionCd; var headerText = "Closed Loop Modeler - " + templateName; if ( controlNameUuid != null ) { @@ -136,25 +135,61 @@ app.service('cldsTemplateService', ['alertService', '$http', '$q', function (ale document.getElementById("modeler_name").textContent = headerText; - - // enable menu options - document.getElementById('Save Template').classList.remove('ThisLink'); - document.getElementById('Template Properties').classList.remove('ThisLink'); - document.getElementById('Test').classList.remove('ThisLink'); - if(!pars.newTemplate){ - document.getElementById('Revert Template Changes').classList.remove('ThisLink'); - } - document.getElementById('Close Template').classList.remove('ThisLink'); - - document.getElementById('Refresh Status').classList.remove('ThisLink'); - //disable save/properties for model + //dropdown options -- always true + document.getElementById('Open Template').classList.remove('ThisLink'); + document.getElementById('Open CL').classList.remove('ThisLink'); document.getElementById('Save CL').classList.add('ThisLink'); document.getElementById('Properties CL').classList.add('ThisLink'); document.getElementById('Revert Model Changes').classList.add('ThisLink'); document.getElementById('Close Model').classList.add('ThisLink'); - document.getElementById('Refresh ASDC').classList.add('ThisLink'); - document.getElementById('Running Instances').classList.add('ThisLink'); + + // enable menu options + if (readTOnly){ + //enable temp options (read only, Open Template) + document.getElementById('Template Properties').classList.remove('ThisLink'); + document.getElementById('Close Template').classList.remove('ThisLink'); + + //disable temp menu options (read only, Open Template) + document.getElementById('Create Template').classList.add('ThisLink'); + document.getElementById('Save Template').classList.add('ThisLink'); + document.getElementById('Revert Template Changes').classList.add('ThisLink'); + + //disable save/properties for model + document.getElementById('Refresh ASDC').classList.add('ThisLink'); + } else { + //enable temp options + document.getElementById('Create Template').classList.remove('ThisLink'); + document.getElementById('Save Template').classList.remove('ThisLink'); + document.getElementById('Template Properties').classList.remove('ThisLink'); + document.getElementById('Validation Test').classList.remove('ThisLink'); + if(!pars.newTemplate){ + document.getElementById('Revert Template Changes').classList.remove('ThisLink'); + } + document.getElementById('Close Template').classList.remove('ThisLink'); + + document.getElementById('Refresh Status').classList.remove('ThisLink'); + + //disable model options + document.getElementById('Refresh ASDC').classList.add('ThisLink'); + + + } + if (readMOnly){ + document.getElementById('Create CL').classList.add('ThisLink'); + } else { + document.getElementById('Create CL').classList.remove('ThisLink'); + } + + // enable/disable menu options based on permittedActionCd list + this.checkPermittedActionCd(permittedActionCd, 'Validation Test', 'TEST'); + this.checkPermittedActionCd(permittedActionCd, 'Submit', 'SUBMIT'); + this.checkPermittedActionCd(permittedActionCd, 'Resubmit', 'RESUBMIT'); + this.checkPermittedActionCd(permittedActionCd, 'Update', 'UPDATE'); + this.checkPermittedActionCd(permittedActionCd, 'Stop', 'STOP'); + this.checkPermittedActionCd(permittedActionCd, 'Restart', 'RESTART'); + this.checkPermittedActionCd(permittedActionCd, 'Delete', 'DELETE'); + this.checkPermittedActionCd(permittedActionCd, 'Deploy', 'DEPLOY'); + this.checkPermittedActionCd(permittedActionCd, 'UnDeploy', 'UNDEPLOY'); - }; }]); diff --git a/src/main/resources/META-INF/resources/designer/scripts/DashboardCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/DashboardCtrl.js index 0fdf5db5..9a0656a1 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/DashboardCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/DashboardCtrl.js @@ -46,8 +46,9 @@ function DashboardCtrl($scope,$rootScope,$resource, $http, $timeout, $location, $interval( function(){ - console.log("interval"); - AutosaveProject($scope,$rootScope,$resource, $http, $timeout, $location, $interval, $q, Datafactory); + console.log("interval"); + /*AutosaveProject($scope,$rootScope,$resource, $http, $timeout, $location, $interval, + $q, Datafactory);*/ }, $scope.autosaveInterval); @@ -605,68 +606,6 @@ function DashboardCtrl($scope,$rootScope,$resource, $http, $timeout, $location, }; - $rootScope.populateUTMModelArray= function(utm_models,utmModels){ - console.log("populateUTMModelArray"); - var modelName =utmModels.name; - if (utmModels != null && utmModels.name != null) { - if($rootScope.oldUTMModels != null && $rootScope.oldUTMModels.length > 0){ - for(var i=0 ;i<$rootScope.oldUTMModels.length;i++ ){ - var tempOldName = $rootScope.oldUTMModels[i]; - console.log("new model name from map:"+old_new_model_name[tempOldName]); - if( utmModels.name == old_new_model_name[tempOldName]){ - modelName = $rootScope.oldUTMModels[i]; - } - } - } - var utm_model = {}; - utm_model.modelName = utmModels.name; - utm_model.modelXML = list_models[modelName]; - utm_model.repeatableHeirachicalSchemaElements = {}; - utm_model.repeatableHeirachicalSchemaElements = list_model_repeatable_heirarchical_elements[modelName]; - - utm_model.testManagementDetails = {}; - utm_model.testManagementDetails = list_model_test_management_details[modelName]; - - var activitytestset={}; - activitytestset.invalidModelException=null; - activitytestset.serviceName=serviceName; - activitytestset.activityTestCases=[]; - if (list_model_test_sets[modelName] != null && list_model_test_sets[modelName].activityTestCases != null) { - activitytestset.activityTestCases=angular.copy(list_model_test_sets[modelName].activityTestCases); - } - utm_model.activityTestSet = activitytestset; - - utm_model.utmPropertyExplorer = {}; - utm_model.utmPropertyExplorer.pathDetailsList = []; - if (list_model_path_details[modelName] != null) { - utm_model.utmPropertyExplorer.pathDetailsList = angular.copy(list_model_path_details[modelName]); - } - - utm_model.utmModelSchemaExtention = {}; - utm_model.utmModelSchemaExtention.utmSchemaExtentionMap = {}; - if (list_model_schema_extensions[modelName] != null) { - utm_model.utmModelSchemaExtention = angular.copy(list_model_schema_extensions[modelName]); - } - - utm_models.push(utm_model); - if(utmModels.subModels != null && utmModels.subModels.length>0){ - for(var i=0 ; i<utmModels.subModels.length;i++) { - var subModel = {}; - subModel = utmModels.subModels[i]; - $scope.populateUTMModelArray(utm_models,subModel); - } - } - } - }; - - - /*$scope.getPallette = function(){ - alert("nothing"); - createNewDiagram(); - alert("after"); - };*/ - - } function changecolor(selected_model) { diff --git a/src/main/resources/META-INF/resources/designer/scripts/ExportFileCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/ExportFileCtrl.js index 72fe83e3..f20601af 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/ExportFileCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/ExportFileCtrl.js @@ -23,99 +23,5 @@ app.controller('exportCtrl', ['$scope', '$rootScope','exportService','dialogs', function($scope,$rootScope,exportService,dialogs){ console.log("exportCtrl"); - - -$scope.exportfile = function(format) { - console.log("//////////exportfile"); - console.log("exporting data inside exportfile function...."); - - var formatValue=format; - $rootScope.exportFormat = format; - var testsetValue=$rootScope.testset; - - var exporturl = "/utm-service/testset_export/exportTestSet"; - - exportService.exportToUrl(testsetValue, formatValue, exporturl) - .then(function(results) { - console.log("results"); - - var sets=results.data; - console.log("Sets value"+sets); - var headerValue=results.headers; - var fileName=headerValue.filename; - console.log("Filename Server value"+fileName); - - - var hiddenElement = document.createElement('a'); - - if (angular.equals($rootScope.exportFormat,"Excel")) { - - var blob = new Blob([sets], {type: "application/vnd.ms-excel"}); - var objectUrl = URL.createObjectURL(blob); - //alert("EXCEL Format"); - hiddenElement.href = objectUrl; - hiddenElement.download = fileName; - } else if (angular.equals($rootScope.exportFormat,"NIST")) { - //alert("NIST Format"); - hiddenElement.href = 'data:attachment/nist,' + encodeURI(sets); - hiddenElement.download = fileName; - } else { - //alert("CSV Format"); - hiddenElement.href = 'data:attachment/csv,' + encodeURI(sets); - hiddenElement.download = fileName; - } - - hiddenElement.target = '_blank'; - hiddenElement.click(); - }, - function(data) { - console.log("data"); - //alert("File upload failed and parameters not returned"); - }); - }; - - /* $rootScope.exportUTMTestSet = function() { - console.log("exportUTMTestSet"); - - - var dlg = dialogs.create('partials/portfolios/export_almqc_data.html','exportALMQCCtrl',{},{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!'; - });*/ - - - /*console.log("exporting data inside exportUTMTestSet function...."); - - - var testsetValue=$rootScope.modeltestset; - - var exporturl = "/utm-service/testset_export/exportMDTTestSet"; - - exportService.exportToUTMTestSet(testsetValue, exporturl) - .then(function(results) { - - var sets=results.data; - console.log("Sets value"+sets); - var headerValue=results.headers; - var fileName="UTMTestSet"; - //console.log("Filename Server value"+fileName); - var hiddenElement = document.createElement('a'); - var blob = new Blob([sets], {type: "application/vnd.ms-excel"}); - var objectUrl = URL.createObjectURL(blob); - //alert("EXCEL Format"); - hiddenElement.href = objectUrl; - hiddenElement.download = fileName; - hiddenElement.target = '_blank'; - hiddenElement.click(); - }, - function(data) { - //alert("File upload failed and parameters not returned"); - }); - };*/ - }]); diff --git a/src/main/resources/META-INF/resources/designer/scripts/ExportFileService.js b/src/main/resources/META-INF/resources/designer/scripts/ExportFileService.js index ee54cfcc..dd99a469 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/ExportFileService.js +++ b/src/main/resources/META-INF/resources/designer/scripts/ExportFileService.js @@ -20,7 +20,6 @@ * =================================================================== * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ - app.service('exportService', ['$http', '$q', function ($http, $q) { console.log("/////////exportService"); this.exportToUrl = function(testsetValue, formatValue, exporturl){ @@ -74,29 +73,4 @@ app.service('exportService', ['$http', '$q', function ($http, $q) { } return def.promise; }; - - this.exportToUTMTestSet = function(almqcExport, exporturl){ - console.log("exportToUTMTestSet"); - var def = $q.defer(); - var sets = []; - //var almqcExport = almqcExport; - $http({ - url: exporturl, method: "POST", data: almqcExport, - responseType: 'arraybuffer' }).success(function (data, status, headers, config) { - console.log("success"); - 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"); - }); - - 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 index d1f606ee..c7f1f6fd 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/FileUploadCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/FileUploadCtrl.js @@ -25,69 +25,7 @@ app.controller('fileUploadCtrl', ['$scope', '$rootScope','fileUpload', function( console.log("///////////fileUploadCtrl"); $rootScope.isAllOption = false; - $scope.uploadSchemaFile = function(element){ - console.log("uploadSchemaFile"); - $scope.$apply(function($scope) { - console.log("apply"); - $rootScope.isStatic = true; - $rootScope.isAllOption = true; - $scope.requiredval= true; - $rootScope.rightTabName ="UTM Build Configuration"; - $rootScope.testSet = null; - $scope.parameters = null; - $scope.constraints =null; - $scope.relations =null; - if($rootScope.isStatic == true){ - document.getElementById('buidConfigBtn').style.visibility = "hidden"; - } - - var file = element.files[0];/*$scope.requestSchemaFile;*/ - console.log('file is ' + JSON.stringify(file)); - $rootScope.file_type="Schema"; - - var uploadUrl = "/utm-service/schema_upload/uploadSchema"; - - //alert("uploadFile file::"+file + " :: " + uploadUrl); - - 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; - - var param = pars.parameters; - - var paramarray = pars.parameters; - var parArray1=[]; - for(var i=0;i<paramarray.length;i++){ - parArray1.push(paramarray[i].required); - } - - $scope.parArray=parArray1; - $scope.constraints =pars.constraints; - $scope.relations =pars.relations; - var con = $scope.constraints; - $scope.required=pars.required; - $scope.required='Required Only'; - }, - 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); - }); - - }); - }; + //-----For Required Radio button functionality @@ -258,4 +196,3 @@ function clearFileInput(id) oldInput.parentNode.replaceChild(newInput, oldInput); } - |