2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
35 function($scope, $rootScope, $modalInstance, $window, $uibModalInstance, cldsModelService, $location,
37 $scope.typeModel = 'template';
42 cldsModelService.getSavedModel().then(function(pars) {
43 $scope.modelNamel = []
44 for (var i = 0; i < pars.length; i++) {
45 $scope.modelNamel.push(pars[i]);
47 setTimeout(function() {
50 $scope.paramsRetry = function() {
51 // $("#paramsWarn").hide();
52 $("#ridinSpinners").css("display", "")
53 $("#ridinSpinners").css("display", "none")
55 $scope.paramsCancel = function() {
56 $("#paramsWarnrefresh").hide();
58 function completeClose() {
63 function callBack(flag) {
68 function contains(a, obj) {
69 var i = a && a.length > 0 ? a.length : 0;
71 if (a[i].toLowerCase() === obj.toLowerCase()) {
77 $scope.checkExisting=function(checkVal, errPatt, num){
79 if (!errPatt && (checkVal!== undefined)){
80 if(contains($scope.modelNamel,name)){
81 $scope["nameinUse"+num]=true;
84 $scope["nameinUse"+num]=false;
88 $scope["nameinUse"+num]=false;
92 function specialCharacters() {
94 if (angular.element("#modelName")
95 && angular.element("#modelName").scope().model.$error.pattern
96 && angular.element("#modelName").scope().model.$error.pattern.length > 0) {
100 $scope.setTypeModel = function(_type) {
101 $scope.error.flag = false;
102 $scope.typeModel = _type;
104 $scope.close = function() {
105 $rootScope.isNewClosed = false;
106 $uibModalInstance.close("closed");
108 $scope.closeDiagram=function(){
109 $window.location.reload();
111 $scope.revertChanges = function() {
114 $scope.openModel = function() {
115 reloadDefaultVariables(false)
116 if (document.getElementById("readOnly")) {
117 readMOnly = document.getElementById("readOnly").checked;
119 var modelName = document.getElementById("modelName").value;
121 $scope.utmModelsArray = [];
122 $scope.selectedParent = {};
123 $scope.currentUTMModel = {};
124 $scope.currentUTMModel.selectedParent = {};
125 $rootScope.oldUTMModels = [];
126 $rootScope.projectName = "clds_default_project";
128 utmModels.name = modelName;
129 utmModels.subModels = [];
130 utmModels.type = 'Model';
131 $rootScope.utmModels = utmModels;
132 cldsModelService.getModel(modelName).then(function(pars) {
133 // deserialize model properties
134 selected_model = modelName;
135 cldsModelService.processActionResponse(modelName);
136 $rootScope.refreshLoopLog();
137 // set model bpmn and open diagram
138 $rootScope.isPalette = true;
141 $uibModalInstance.close("closed");