Browse Source

HUE-2371 [sentry] Sentry URI should be created only with a ALL permission

Set select2 to All and disabled it
Enrico Berti 11 years ago
parent
commit
4d865a4

+ 1 - 1
apps/security/src/security/templates/hive.mako

@@ -67,7 +67,7 @@ ${ layout.menubar(section='hive') }
     </div>
     <input type="text" data-bind="filechooser: $data.URI, enable: privilegeType() == 'uri'" placeholder="URI">
 
-    <select data-bind="options: $root.availableActions, select2: { update: $data.action, type: 'action'}" style="width: 100px"></select>
+    <select data-bind="options: $root.availableActions, select2: { update: $data.action, type: 'action', readonly: (privilegeType() == 'uri'), readonlySetTo: function(){ (privilegeType() == 'uri') ? $data.action($root.availableActions()[0]) : $data.action('ALL') }}" style="width: 100px"></select>
 
     <div class="new-line-if-small">
       <label class="checkbox"><input type="checkbox" data-bind="checked: grantOption"> ${ _('With grant') }</label>

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

@@ -100,6 +100,12 @@ ko.bindingHandlers.select2 = {
     if (typeof valueAccessor().update != "undefined") {
       $(element).select2("val", valueAccessor().update());
     }
+    if (typeof valueAccessor().readonly != "undefined") {
+      $(element).select2("readonly", valueAccessor().readonly);
+      if (typeof valueAccessor().readonlySetTo != "undefined") {
+        valueAccessor().readonlySetTo();
+      }
+    }
   }
 };