Эх сурвалжийг харах

HUE-2361 [sentry] Specify a new role on the grant modal

Changed a bit the style too
Enrico Berti 11 жил өмнө
parent
commit
fc2b419

+ 4 - 3
apps/security/src/security/templates/hive.mako

@@ -385,9 +385,10 @@ ${ layout.menubar(section='hive') }
       <div data-bind="template: { name: 'privilege', data: $root.grantToPrivilege() }"></div>
     <!-- /ko -->
 
-    <h4>${ _('To') }</h4>
-    <select data-bind="options: $root.selectableRoles(), value: $root.grantToPrivilegeRole, select2: { update: $root.grantToPrivilegeRole, placeholder: '${ _("Select a role") }' }" style="width: 360px"></select>
-    </br>
+    <br/>
+    <span>${ _('To role') }&nbsp;&nbsp;</span>
+    <select data-bind="options: $root.selectableRoles(), value: $root.grantToPrivilegeRole, select2: { update: $root.grantToPrivilegeRole, placeholder: '${ _("Select a role") }', type: 'role' }" style="width: 360px"></select>
+    <br/>
 
   </div>
   <div class="modal-footer">

+ 3 - 0
apps/security/static/js/common.ko.js

@@ -77,6 +77,9 @@ ko.bindingHandlers.select2 = {
                 if (_type == "scope") {
                   viewModel.availablePrivileges.push(_newVal);
                 }
+                if (_type == "role") {
+                  viewModel.roles.push(new Role(viewModel, { name: _newVal }));
+                }
                 if (_isArray){
                   var _vals = $(element).select2("val");
                   _vals.push(_newVal);