1717angular . module ( 'zeppelinWebApp' ) . controller ( 'CredentialCtrl' , function ( $scope , $route , $routeParams , $location , $rootScope ,
1818 $http , baseUrlSrv , ngToast ) {
1919 $scope . _ = _ ;
20-
20+
2121 $scope . credentialInfo = [ ] ;
2222 $scope . showAddNewCredentialInfo = false ;
23-
23+
2424 var getCredentialInfo = function ( ) {
2525 $http . get ( baseUrlSrv . getRestApiBase ( ) + '/credential' ) .
2626 success ( function ( data , status , headers , config ) {
27-
27+
2828 $scope . credentialInfo = _ . map ( data . body . userCredentials , function ( value , prop ) {
2929 return { entity : prop , password : value . password , username : value . username } ;
3030 } ) ;
@@ -34,7 +34,7 @@ angular.module('zeppelinWebApp').controller('CredentialCtrl', function($scope, $
3434 console . log ( 'Error %o %o' , status , data . message ) ;
3535 } ) ;
3636 } ;
37-
37+
3838 $scope . addNewCredentialInfo = function ( ) {
3939 if ( $scope . entity && _ . isEmpty ( $scope . entity . trim ( ) ) &&
4040 $scope . username && _ . isEmpty ( $scope . username . trim ( ) ) ) {
@@ -45,13 +45,13 @@ angular.module('zeppelinWebApp').controller('CredentialCtrl', function($scope, $
4545 } ) ;
4646 return ;
4747 }
48-
48+
4949 var newCredential = {
5050 'entity' : $scope . entity ,
5151 'username' : $scope . username ,
5252 'password' : $scope . password
5353 } ;
54-
54+
5555 $http . put ( baseUrlSrv . getRestApiBase ( ) + '/credential' , newCredential ) .
5656 success ( function ( data , status , headers , config ) {
5757 ngToast . success ( {
@@ -73,33 +73,33 @@ angular.module('zeppelinWebApp').controller('CredentialCtrl', function($scope, $
7373 console . log ( 'Error %o %o' , status , data . message ) ;
7474 } ) ;
7575 } ;
76-
76+
7777 $scope . cancelCredentialInfo = function ( ) {
7878 $scope . showAddNewCredentialInfo = false ;
7979 resetCredentialInfo ( ) ;
8080 } ;
81-
81+
8282 var resetCredentialInfo = function ( ) {
8383 $scope . entity = '' ;
8484 $scope . username = '' ;
8585 $scope . password = '' ;
8686 } ;
87-
87+
8888 $scope . copyOriginCredentialsInfo = function ( ) {
8989 ngToast . info ( {
9090 content : 'Since entity is a unique key, you can edit only username & password' ,
9191 verticalPosition : 'bottom' ,
9292 timeout : '3000'
9393 } ) ;
9494 } ;
95-
95+
9696 $scope . updateCredentialInfo = function ( form , data , entity ) {
9797 var request = {
9898 entity : entity ,
9999 username : data . username ,
100100 password : data . password
101101 } ;
102-
102+
103103 $http . put ( baseUrlSrv . getRestApiBase ( ) + '/credential/' , request ) .
104104 success ( function ( data , status , headers , config ) {
105105 var index = _ . findIndex ( $scope . credentialInfo , { 'entity' : entity } ) ;
@@ -117,7 +117,7 @@ angular.module('zeppelinWebApp').controller('CredentialCtrl', function($scope, $
117117 } ) ;
118118 return false ;
119119 } ;
120-
120+
121121 $scope . removeCredentialInfo = function ( entity ) {
122122 BootstrapDialog . confirm ( {
123123 closable : false ,
@@ -140,10 +140,10 @@ angular.module('zeppelinWebApp').controller('CredentialCtrl', function($scope, $
140140 }
141141 } ) ;
142142 } ;
143-
143+
144144 var init = function ( ) {
145145 getCredentialInfo ( ) ;
146146 } ;
147-
147+
148148 init ( ) ;
149149} ) ;
0 commit comments