diff options
author | TATTAVARADA <statta@research.att.com> | 2017-04-27 07:53:18 -0400 |
---|---|---|
committer | st782s <statta@research.att.com> | 2017-04-27 08:31:27 -0400 |
commit | 6beb446925c967aca92f5513adf36c5db77c00d6 (patch) | |
tree | 9392057ed0739de2445c5b2a2a8bee6dcdacbcf7 /ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/loginSnippet.html | |
parent | 246b225194e3e8dc1926294de591a94fd9787fa7 (diff) |
[PORTAL-7] Rebase
This rebasing includes common libraries and common overlays projects
abstraction of components
Change-Id: Ia1efa4deacdc5701e6205104ac021a6c80ed60ba
Signed-off-by: st782s <statta@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/loginSnippet.html')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/loginSnippet.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/loginSnippet.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/loginSnippet.html new file mode 100644 index 00000000..19868bb6 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/loginSnippet.html @@ -0,0 +1,63 @@ + + +<script> +var loginSnippetCtrl = function ($scope,$http, $log,UserInfoServiceDS2){ + /*Define fields*/ + $scope.userProfile={ + firstName:'', + lastName:'', + fullName:'', + email:'' + } + /*Put user info into fields*/ + $scope.inputUserInfo = function(userInfo){ + if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){ + if (typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null && userInfo.USER_FIRST_NAME!='') + $scope.userProfile.firstName = userInfo.USER_FIRST_NAME; + if (typeof(userInfo.USER_LAST_NAME) != "undefined" && userInfo.USER_LAST_NAME!=null && userInfo.USER_LAST_NAME!='') + $scope.userProfile.lastName = userInfo.USER_LAST_NAME; + if (typeof(userInfo.USER_EMAIL) != "undefined" && userInfo.USER_EMAIL!=null && userInfo.USER_EMAIL!='') + $scope.userProfile.email = userInfo.USER_EMAIL; + if (typeof(userInfo.USER_ORG_USER_ID) != "undefined" && userInfo.USER_ORG_USER_ID!=null && userInfo.USER_ORG_USER_ID!='') + $scope.userProfile.orgUserId = userInfo.USER_ORG_USER_ID; + } + } + /*getting user info from session*/ + $scope.getUserNameFromSession = function(){ + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + var j = response; + // console.log(response); + $scope.userProfile.fullName = response.userName; + $scope.userProfile.orgUserId = response.orgUserId; + $scope.userProfile.email = response.email; + }); + } + /*getting user info from shared context*/ + $scope.getUserName=function() { + var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext(); + promise.then( + function(res) { + if(res==null || res==''){ + $log.info('loginSnippet: get user information from session'); + $scope.getUserNameFromSession(); + }else{ + // $log.info('Received User information from shared context',res); + var resData = res; + /* $scope.inputUserInfo(resData); */ + $scope.userProfile.fullName = $scope.userProfile.firstName+ ' '+ $scope.userProfile.lastName; + } + }, + function(err) { + console.log('error'); + } + ); + }; + /*call the get user info function*/ + try{ + $scope.getUserName(); + }catch(err){ + $log.info('Error while getting User information',err); + } +} + </script>
\ No newline at end of file |