2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 
   6  * ================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License");
 
   8  * you may not use this file except in compliance with the License.
 
   9  * You may obtain a copy of the License at
 
  11  *      http://www.apache.org/licenses/LICENSE-2.0
 
  13  * Unless required by applicable law or agreed to in writing, software
 
  14  * distributed under the License is distributed on an "AS IS" BASIS,
 
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16  * See the License for the specific language governing permissions and
 
  17  * limitations under the License.
 
  18  * ============LICENSE_END=========================================================
 
  20 app.controller('editVsclActionController' ,  function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){
 
  21     if(message.vsclActionDictionaryData==null)
 
  22         $scope.label='Add VSCL Action'
 
  24         $scope.label='Edit VSCL Action'
 
  25         $scope.disableCd=true;
 
  29         /*getting user info from session*/
 
  31         UserInfoServiceDS2.getFunctionalMenuStaticDetailSession()
 
  32                 .then(function (response) {                     
 
  33                         userid = response.userid;               
 
  36     $scope.editvsclAction = message.vsclActionDictionaryData;
 
  38     $scope.saveCLVSCLAction = function(vsclActionDictionaryData) {
 
  39         var regex = new RegExp("^[a-zA-Z0-9_]*$");
 
  40         if(!regex.test(vsclActionDictionaryData.vsclaction)) {
 
  41                 Notification.error("Enter Valid VSCL Action Name without spaces or special characters");
 
  43                 var uuu = "saveDictionary/cl_dictionary/save_vsclAction";
 
  44                 var postData={vsclActionDictionaryData: vsclActionDictionaryData, userid: userid};
 
  49                         contentType: 'application/json',
 
  50                         data: JSON.stringify(postData),
 
  51                         success : function(data){
 
  52                                 $scope.$apply(function(){
 
  53                                         $scope.vsclActionDictionaryDatas=data.vsclActionDictionaryDatas;});
 
  54                                 if($scope.vsclActionDictionaryDatas == "Duplicate"){
 
  55                                         Notification.error("ClosedLoop VSCLAction Dictionary exists with Same VSCLAction Name.")
 
  57                                         console.log($scope.vsclActionDictionaryDatas);
 
  58                                         $modalInstance.close({vsclActionDictionaryDatas:$scope.vsclActionDictionaryDatas});
 
  61                         error : function(data){
 
  62                                 alert("Error while saving.");
 
  68     $scope.close = function() {
 
  69         $modalInstance.close();