2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017, 2019 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('editBRMSControllerController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){
21 if(message.brmsControllerDictionaryDatas==null)
22 $scope.label='Add New BRMS Controller'
25 $scope.label='View BRMS Controller'
27 $scope.label='Edit BRMS Controller'
29 $scope.disableCd=true;
31 $scope.editBRMSController = message.brmsControllerDictionaryDatas;
32 $scope.disabled = message.disabled;
34 /*getting user info from session*/
36 UserInfoServiceDS2.getFunctionalMenuStaticDetailSession()
37 .then(function (response) {
38 userid = response.userid;
41 $scope.saveBRMSController = function(brmsControllerDictionaryData) {
42 var regex = new RegExp("^[a-zA-Z0-9_]*$");
43 if(!regex.test(brmsControllerDictionaryData.controllerName)) {
44 Notification.error("Enter Valid Controller Name without spaces or special characters");
46 var uuu = "saveDictionary/brms_dictionary/save_BRMSControllerData";
47 if(brmsControllerDictionaryData && brmsControllerDictionaryData.controllerName){
48 if(brmsControllerDictionaryData.controller){
49 var postData={brmsControllerDictionaryData: brmsControllerDictionaryData, userid: userid};
54 contentType: 'application/json',
55 data: JSON.stringify(postData),
56 success : function(data){
57 $scope.$apply(function(){
58 $scope.brmsControllerDictionaryDatas=data.brmsControllerDictionaryDatas;});
59 if($scope.brmsControllerDictionaryDatas == "Duplicate"){
60 Notification.error("BRMS Controller Dictionary exists with Same Controller Name.")
61 }else if($scope.brmsControllerDictionaryDatas == "Error"){
62 Notification.error("BRMS Controller is not in proper required format");
64 console.log($scope.brmsControllerDictionaryDatas);
65 $modalInstance.close({brmsControllerDictionaryDatas:$scope.brmsControllerDictionaryDatas});
68 error : function(data){
69 Notification.error("Error while saving.");
73 Notification.error("Controller Field is Empty.");
76 Notification.error("BRMS Controller Name should be given.");
81 $scope.close = function() {
82 $modalInstance.close();