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