zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject incubator-zeppelin git commit: Add username in place of Connected
Date Sat, 26 Mar 2016 04:22:57 GMT
Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master df39c022b -> 4ece1e095


Add username in place of Connected

### What is this PR for?
To show more information on the navigation bar about user.
 - show 'Connected' if it is an anonymous user.
 - show the username if it is not an anonymous user.

### What type of PR is it?
Improvement

### Todos
* [x] - Change HTML

### What is the Jira issue?

### How should this be tested?
Case 1 :   Anonymous User
                to be an anonymous user, make the following changes in /conf/shiro.ini  file
               1. Uncomment                    /** = anon
               2. Comment                       /** = authcBasic
               3. Restart Zeppelin.

case 2:    Non-anonymous User
               to be a non-anonymous user, make the following changes in /conf/shiro.ini 
file
               1. Comment                     /** = anon
               2. Uncomment                 /** = authcBasic
               3. Restart Zeppelin
               4. On Zeppelin Web page it will ask for username and password. Use one of the
username and    password from the list  given in conf/shiro.ini file to login.

### Screenshots (if appropriate)
For example, if anonymous user it will show 'Connected'.
![screen shot 2016-03-21 at 12 14 53 pm](https://cloud.githubusercontent.com/assets/7026661/13912405/dda37e08-ef62-11e5-9ccc-593406930da1.png)
And for non -anonymous user for example a user with userid 'admin'  will show the username
as below
![screen shot 2016-03-21 at 12 16 28 pm](https://cloud.githubusercontent.com/assets/7026661/13912407/defceaf0-ef62-11e5-8186-ea08ddee8baf.png)

### Questions:
* Does the licenses files need update?no
* Is there breaking changes for older versions?no
* Does this needs documentation?no

Author: Ravi Ranjan <ranjanravi0308@gmail.com>

Closes #788 from ravicodder/showUsername and squashes the following commits:

89a159a [Ravi Ranjan] Merge branch 'master' of https://github.com/apache/incubator-zeppelin
into showUsername
f2dcb16 [Ravi Ranjan] Add check on maximum user length and show on tootip
babeadd [Ravi Ranjan] Add username in place of Connected


Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/4ece1e09
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/4ece1e09
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/4ece1e09

Branch: refs/heads/master
Commit: 4ece1e095b9e60b2f68a4763bcef615378fdd3c7
Parents: df39c02
Author: Ravi Ranjan <ranjanravi0308@gmail.com>
Authored: Tue Mar 22 17:17:11 2016 +0530
Committer: Lee moon soo <moon@apache.org>
Committed: Fri Mar 25 21:23:11 2016 -0700

----------------------------------------------------------------------
 .../src/components/navbar/navbar.controller.js         | 13 +++++++++++++
 zeppelin-web/src/components/navbar/navbar.html         |  8 ++++----
 2 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/4ece1e09/zeppelin-web/src/components/navbar/navbar.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/navbar/navbar.controller.js b/zeppelin-web/src/components/navbar/navbar.controller.js
index 30e6ac2..f04522f 100644
--- a/zeppelin-web/src/components/navbar/navbar.controller.js
+++ b/zeppelin-web/src/components/navbar/navbar.controller.js
@@ -23,6 +23,9 @@ angular.module('zeppelinWebApp').controller('NavCtrl', function($scope,
$rootSco
   vm.connected = websocketMsgSrv.isConnected();
   vm.websocketMsgSrv = websocketMsgSrv;
   vm.arrayOrderingSrv = arrayOrderingSrv;
+  $rootScope.fullUsername = $rootScope.ticket.principal;
+  $rootScope.truncatedUsername = $rootScope.ticket.principal;
+  var MAX_USERNAME_LENGTH=16;
 
   angular.element('#notebook-list').perfectScrollbar({suppressScrollX: true});
 
@@ -43,6 +46,15 @@ angular.module('zeppelinWebApp').controller('NavCtrl', function($scope,
$rootSco
     }
   });
 
+  $scope.checkUsername = function () {
+    if($rootScope.ticket.principal.length <= MAX_USERNAME_LENGTH) {
+       $rootScope.truncatedUsername=$rootScope.ticket.principal;
+      }
+    else {
+           $rootScope.truncatedUsername=$rootScope.ticket.principal.substr(0,MAX_USERNAME_LENGTH)+'..';
+      }
+  };
+
   $scope.search = function() {
     $location.url(/search/ + $scope.searchTerm);
   };
@@ -59,5 +71,6 @@ angular.module('zeppelinWebApp').controller('NavCtrl', function($scope,
$rootSco
   vm.isActive = isActive;
 
   vm.loadNotes();
+  $scope.checkUsername();
 
 });

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/4ece1e09/zeppelin-web/src/components/navbar/navbar.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/navbar/navbar.html b/zeppelin-web/src/components/navbar/navbar.html
index a795870..f6d386f 100644
--- a/zeppelin-web/src/components/navbar/navbar.html
+++ b/zeppelin-web/src/components/navbar/navbar.html
@@ -74,11 +74,11 @@ limitations under the License.
               </span>
             </div>
           </form>
-        </li>
-        <li class="server-status">
+        <li class="server-status"  >
           <i class="fa fa-circle" ng-class="{'server-connected':navbar.connected, 'server-disconnected':!navbar.connected}"></i>
-          <span ng-show="navbar.connected">Connected</span>
-          <span ng-show="!navbar.connected">Disconnected</span>
+        <span ng-show="navbar.connected" ng-if="ticket.principal == 'anonymous' ">Connected</span>
+        <span ng-show="navbar.connected" ng-if="ticket.principal != 'anonymous' " tooltip-placement="bottom"
tooltip="{{fullUsername}}">{{truncatedUsername}}</span>
+        <span ng-show="!navbar.connected">Disconnected</span>
         </li>
       </ul>
     </div>


Mime
View raw message