ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-17042. Refine Role page UI display (alexantonenko)
Date Sat, 04 Jun 2016 10:31:24 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 2f7beef82 -> 3b8111f3a


AMBARI-17042. Refine Role page UI display (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3b8111f3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3b8111f3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3b8111f3

Branch: refs/heads/trunk
Commit: 3b8111f3aee10f069b5fc0e0e2c041c7fcfd671b
Parents: 2f7beef
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Sat Jun 4 12:15:13 2016 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Sat Jun 4 13:31:19 2016 +0300

----------------------------------------------------------------------
 .../ui/admin-web/app/scripts/i18n.config.js     |  3 +-
 .../admin-web/app/scripts/services/Cluster.js   |  2 ++
 .../app/scripts/services/RoleDetailsModal.js    | 32 ++++++++++++++------
 .../resources/ui/admin-web/app/styles/main.css  |  9 ++++++
 .../app/views/modals/RoleDetailsModal.html      | 17 ++++++++---
 5 files changed, 48 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3b8111f3/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
index 7474d5f..6fe46dc 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
@@ -352,7 +352,8 @@ angular.module('ambariAdminConsole')
         'ambariAdmin': 'Ambari Administrator',
         'viewUser': 'View User',
         'none': 'None',
-        'oneRolePerUser': 'Only 1 role allowed per user'
+        'oneRolePerUser': 'Only 1 role allowed per user',
+        'permissionLevel': '{{level}}-level Permissions'
       },
 
       'alerts': {

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b8111f3/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
index c1cf221..33ed7ed 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
@@ -78,6 +78,8 @@ angular.module('ambariAdminConsole')
       "AMBARI.SET_SERVICE_USERS_GROUPS"
     ],
 
+    orderedLevels: ['SERVICE', 'HOST', 'CLUSTER', 'AMBARI'],
+
     ineditableRoles : ['VIEW.USER', 'AMBARI.ADMINISTRATOR'],
 
     getAllClusters: function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b8111f3/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RoleDetailsModal.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RoleDetailsModal.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RoleDetailsModal.js
index 7c03f4d..5a14b33 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RoleDetailsModal.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RoleDetailsModal.js
@@ -36,20 +36,34 @@ angular.module('ambariAdminConsole')
           $scope.title = '';
           $scope.orderedRoles = ['AMBARI.ADMINISTRATOR'].concat(Cluster.orderedRoles).reverse();
           $scope.orderedAuthorizations = Cluster.orderedAuthorizations;
+          $scope.orderedLevels = Cluster.orderedLevels;
           $scope.authHash = {};
-          roles.map(function(r) {
-            r.authorizations.map(function(auth) {
-              $scope.authHash[auth.authorization_id] = auth.authorization_name;
+          $scope.getLevelName = function (key) {
+            return key.charAt(0) + key.slice(1).toLowerCase();
+          };
+          angular.forEach(roles, function (r) {
+            angular.forEach(r.authorizations, function (auth) {
+              var match = auth.authorization_id.match(/(\w+)\./),
+                levelKey = match && match[1],
+                isLevelDisplayed = $scope.orderedAuthorizations.some(function (item) {
+                  return !item.indexOf(levelKey);
+                });
+              if (isLevelDisplayed) {
+                if (!$scope.authHash[levelKey]) {
+                  $scope.authHash[levelKey] = {};
+                }
+                if (!$scope.authHash[levelKey][auth.authorization_id]) {
+                  $scope.authHash[levelKey][auth.authorization_id] = auth.authorization_name;
+                }
+                if (!r.authHash) {
+                  r.authHash = {};
+                }
+                r.authHash[auth.authorization_id] = true;
+              }
             });
           });
           $scope.roles = roles.sort(function(a, b) {
             return $scope.orderedRoles.indexOf(a.permission_name) - $scope.orderedRoles.indexOf(b.permission_name);
-          }).map(function(r) {
-            r.authHash = {};
-            r.authorizations.map(function(a) {
-              r.authHash[a.authorization_id] = true;
-            });
-            return r;
           });
           $scope.ok = function() {
             $modalInstance.dismiss();

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b8111f3/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
index 12f44bb..542177d 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
@@ -1841,6 +1841,15 @@ thead.view-permission-header > tr > th {
   visibility: hidden;
 }
 
+.role-details-modal .table-section-title {
+  font-weight: bold;
+}
+
+.role-details-modal .table-section-title .table-cell {
+  width: 100%;
+}
+
+
 .proxied-field-wrap {
   display:block;
   position:absolute;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b8111f3/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/RoleDetailsModal.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/RoleDetailsModal.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/RoleDetailsModal.html
index 776b33d..926bea9 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/RoleDetailsModal.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/RoleDetailsModal.html
@@ -33,11 +33,18 @@
     <div class="table-cell">{{roles[roles.length - 1].permission_label}}</div>
   </div>
   <div class="table-body">
-    <div class="table-row-wrapper">
-      <div class="table-row" ng-repeat="auth in orderedAuthorizations">
-        <div class="table-cell">{{authHash[auth]}}</div>
-        <div class="table-cell text-center" ng-repeat="role in roles">
-          <i class="glyphicon glyphicon-ok green-icon" ng-show="role.authHash[auth]"></i>
+    <div ng-repeat="level in orderedLevels">
+      <div class="table-row-wrapper table-section-title">
+        <div class="table-row">
+          <div class="table-cell" colspan="{{roles.length + 1}}">{{'users.roles.permissionLevel'
| translate: '{level: getLevelName(level)}'}}</div>
+        </div>
+      </div>
+      <div class="table-row-wrapper">
+        <div class="table-row" ng-repeat="auth in orderedAuthorizations" ng-if="authHash[level][auth]">
+          <div class="table-cell">{{authHash[level][auth]}}</div>
+          <div class="table-cell text-center" ng-repeat="role in roles">
+            <i class="glyphicon glyphicon-ok green-icon" ng-show="role.authHash[auth]"></i>
+          </div>
         </div>
       </div>
     </div>


Mime
View raw message