Browse Source

[security] Move Sentry save role button to the bottom

Romain Rigaux 11 years ago
parent
commit
94c008f
2 changed files with 26 additions and 18 deletions
  1. 14 10
      apps/security/src/security/templates/hive.mako
  2. 12 8
      apps/security/static/js/hive.ko.js

+ 14 - 10
apps/security/src/security/templates/hive.mako

@@ -27,7 +27,7 @@ ${ commonheader(_('Hadoop Security'), "security", user) | n,unicode }
 ${ layout.menubar(section='hive') }
 
 <script type="text/html" id="privilege">
-<div data-bind="visible: status() != 'deleted', click: function() { if (! editing()) { editing(true); } }" class="acl-block acl-block-airy">
+<div data-bind="visible: status() != 'deleted' && status() != 'alreadydeleted', click: function() { if (! editing()) { editing(true); } }" class="acl-block acl-block-airy">
 
   <!-- ko if: editing() -->
     <a href="javascript: void(0)" class="pull-right" style="margin-right: 4px">
@@ -212,18 +212,14 @@ ${ layout.menubar(section='hive') }
                   <a href=""><span data-bind="text: grantorPrincipal"></span></a>
                 </td>
                 <td>
-                  <button type="button" rel="tooltip" data-placement="bottom" data-loading-text="${ _('Saving...') }" data-original-title="${ _('Save') }" class="btn btn-primary"
-                    data-bind="click: $root.role.savePrivileges, visible: privilegesChanged().length">
-                    <i class="fa fa-save"></i>
-                  </button>
                 </td>
               </tr>
               <tr>
-                  <td colspan="2"></td>
-                  <td colspan="4">
-                    <div data-bind="template: { name: 'privilege', foreach: $data.privileges }, visible: $data.showPrivileges">
-                    </div>
-                  </td>
+                <td colspan="2"></td>
+                <td colspan="4">
+                  <div data-bind="template: { name: 'privilege', foreach: $data.privileges }, visible: $data.showPrivileges">
+                  </div>
+                </td>
               </tr>
               <tr>
                 <td colspan="2"></td>
@@ -233,6 +229,14 @@ ${ layout.menubar(section='hive') }
                   </div>
                 </td>
               </tr>
+              <tr>
+                <td colspan="2"></td>
+                <td colspan="4">
+                  <div class="acl-block pointer add-acl" data-bind="click: $root.role.savePrivileges, visible: privilegesChanged().length > 0">
+                    <i class="fa fa-save"></i>
+                  </div>
+                </td>
+              </tr>              
             </tbody>
           </table>
         </div>

+ 12 - 8
apps/security/static/js/hive.ko.js

@@ -75,17 +75,21 @@ var Privilege = function (vm, privilege) {
 	owner: self
   });
   self.privilegeScope = ko.computed(function() {
-      if (self.tableName().length > 0) {
-        return 'TABLE';	
-      } else if (self.dbName().length > 0) {
-    	return 'DATABASE';
-      } else {
-    	return 'SERVER';
-      }
+    if (self.tableName().length > 0) {
+      return 'TABLE';	
+    } else if (self.dbName().length > 0) {
+  	  return 'DATABASE';
+    } else {
+      return 'SERVER';
+    }
   });  
   
   self.remove = function (privilege) {
-    privilege.status('deleted');
+	if (privilege.status() == 'new') {
+	  privilege.status('alreadydeleted');
+	} else {
+      privilege.status('deleted');
+	}
   }
 }