Sfoglia il codice sorgente

HUE-6579 [security] Resolve double binding on the Solr part

Enrico Berti 8 anni fa
parent
commit
1999d6822f

+ 3 - 2
apps/security/src/security/templates/hdfs.mako

@@ -137,7 +137,7 @@ ${ layout.menubar(section='hdfs', is_embeddable=is_embeddable) }
                 </div>
               </div>
 
-              ${ tree.render(id='expandableTree', data='$root.assist.treeData', afterRender='$root.assist.afterRender') }
+              ${ tree.render(id='expandableTree', data='$root.assist.treeData', afterRender='$root.assist.afterRender', component='hdfs') }
             </div>
             <div class="span4">
               <div class="acl-panel" data-bind="visible: ! $root.assist.isLoadingAcls()">
@@ -290,7 +290,7 @@ ${ layout.menubar(section='hdfs', is_embeddable=is_embeddable) }
 </%def>
 
 
-${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assist.togglePath', itemSelected='$root.assist.path() == path()', iconModifier=treeIcons, styleModifier='aclBit', styleModifierPullRight=aclBitPullRight, anchorProperty='path', showMore='$root.assist.loadMore', strikedProperty='striked', itemChecked='isChecked') }
+${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assist.togglePath', itemSelected='$root.assist.path() == path()', iconModifier=treeIcons, styleModifier='aclBit', styleModifierPullRight=aclBitPullRight, anchorProperty='path', showMore='$root.assist.loadMore', strikedProperty='striked', itemChecked='isChecked', component='hdfs') }
 
 
 <script src="${ static('security/js/hdfs.ko.js') }" type="text/javascript" charset="utf-8"></script>
@@ -298,6 +298,7 @@ ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assi
 <script type="text/javascript">
   (function () {
     var viewModel = new HdfsViewModel(${ initial | n,unicode });
+    ko.cleanNode($('#securityHdfsComponents')[0]);
     ko.applyBindings(viewModel, $('#securityHdfsComponents')[0]);
 
     $(document).ready(function () {

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

@@ -215,7 +215,7 @@ ${ layout.menubar(section='hive1', is_embeddable=is_embeddable) }
                 </div>
               </div>
 
-              ${ tree.render(id='expandableTree', data='$root.assist.treeData', afterRender='$root.assist.afterRender') }
+              ${ tree.render(id='expandableTree', data='$root.assist.treeData', afterRender='$root.assist.afterRender', component='hive') }
 
             </div>
             <div class="span6 acl-panel">
@@ -546,7 +546,7 @@ ${ layout.menubar(section='hive1', is_embeddable=is_embeddable) }
 </%def>
 
 
-${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assist.togglePath', itemSelected='$root.assist.path() == path()', styleModifier='withPrivileges', iconModifier=treeIcons, anchorProperty='path', itemChecked='isChecked', styleModifierPullRight=withPrivilegesPullRight) }
+${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assist.togglePath', itemSelected='$root.assist.path() == path()', styleModifier='withPrivileges', iconModifier=treeIcons, anchorProperty='path', itemChecked='isChecked', styleModifierPullRight=withPrivilegesPullRight, component='hive') }
 
 
 <script src="${ static('security/js/hive.ko.js') }" type="text/javascript" charset="utf-8"></script>
@@ -561,6 +561,7 @@ ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assi
     });
 
     var viewModel = new HiveViewModel(${ initial | n,unicode });
+    ko.cleanNode($('#securityHiveComponents')[0]);
     ko.applyBindings(viewModel, $('#securityHiveComponents')[0]);
 
     $(document).ready(function () {

+ 3 - 2
apps/security/src/security/templates/sentry.mako

@@ -268,7 +268,7 @@ ${ layout.menubar(section=component, is_embeddable=is_embeddable) }
                 </div>
               </div>
 
-              ${ tree.render(id='expandableTree', data='$root.assist.treeData', afterRender='$root.assist.afterRender') }
+              ${ tree.render(id='expandableTree', data='$root.assist.treeData', afterRender='$root.assist.afterRender', component='security') }
 
             </div>
             <div class="span6 acl-panel">
@@ -602,7 +602,7 @@ ${ layout.menubar(section=component, is_embeddable=is_embeddable) }
 </%def>
 
 
-${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assist.togglePath', itemSelected='$root.assist.path() == path()', styleModifier='withPrivileges', iconModifier=treeIcons, anchorProperty='path', itemChecked='isChecked', styleModifierPullRight=withPrivilegesPullRight) }
+${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assist.togglePath', itemSelected='$root.assist.path() == path()', styleModifier='withPrivileges', iconModifier=treeIcons, anchorProperty='path', itemChecked='isChecked', styleModifierPullRight=withPrivilegesPullRight, component='security') }
 
 
 <script src="${ static('security/js/sentry.ko.js') }" type="text/javascript" charset="utf-8"></script>
@@ -616,6 +616,7 @@ ${ tree.import_templates(itemClick='$root.assist.setPath', iconClick='$root.assi
     });
 
     var viewModel = new SentryViewModel(${ initial | n,unicode });
+    ko.cleanNode($('#securityComponents')[0]);
     ko.applyBindings(viewModel, $('#securityComponents')[0]);
 
     $(document).ready(function () {

+ 12 - 12
desktop/core/src/desktop/templates/common_tree.mako

@@ -25,26 +25,26 @@
   from django.utils.translation import ugettext as _
 %>
 
-<%def name="import_templates(itemClick=None, iconClick=None, itemDblClick=None, itemSelected=None, iconModifier=None, styleModifier=None, styleModifierPullRight=None, showMore=None, anchorProperty=None, strikedProperty=None, itemChecked=None)">
+<%def name="import_templates(itemClick=None, iconClick=None, itemDblClick=None, itemSelected=None, iconModifier=None, styleModifier=None, styleModifierPullRight=None, showMore=None, anchorProperty=None, strikedProperty=None, itemChecked=None, component='')">
 
   <script src="${ static('desktop/js/ko.tree.js') }" type="text/javascript" charset="utf-8"></script>
 
-  <script type="text/html" id="tree-template">
+  <script type="text/html" id="tree-template${ component }">
     <!-- ko if: nodes != null -->
     <ul class="tree" data-bind="foreach: nodes">
       <li>
-        <span data-bind="template: { name: 'node-name-template', data: $data }"></span>
-        <div data-bind="template: { name: 'folder-template', data: $data }, visible: isExpanded"></div>
+        <span data-bind="template: { name: 'node-name-template${ component }', data: $data }"></span>
+        <div data-bind="template: { name: 'folder-template${ component }', data: $data }, visible: isExpanded"></div>
       </li>
     </ul>
     <!-- /ko -->
   </script>
 
-  <script type="text/html" id="folder-template">
+  <script type="text/html" id="folder-template${ component }">
     <ul>
       <!-- ko foreach: nodes -->
       <li>
-        <div data-bind="template: { name: 'node-template', data: $data }"></div>
+        <div data-bind="template: { name: 'node-template${ component }', data: $data }"></div>
       </li>
       <!-- /ko -->
       %if showMore:
@@ -59,19 +59,19 @@
     </ul>
   </script>
 
-  <script type="text/html" id="node-template">
+  <script type="text/html" id="node-template${ component }">
     <!-- ko if: nodes != null -->
     <span data-bind="
-          template: { name: 'node-name-template', data: $data },
+          template: { name: 'node-name-template${ component }', data: $data },
           css: { 'pointer-icon': nodes().length > 0 }"></span>
     <!-- /ko -->
 
     <!-- ko if: nodes().length !== 0 -->
-    <div data-bind="template: { name: 'folder-template', data: $data }, visible: isExpanded"></div>
+    <div data-bind="template: { name: 'folder-template${ component }', data: $data }, visible: isExpanded"></div>
     <!-- /ko -->
   </script>
 
-  <script type="text/html" id="node-name-template">
+  <script type="text/html" id="node-name-template${ component }">
     <div class="node-row" data-bind="
     %if itemSelected:
      css: { selected: ${itemSelected}}
@@ -132,7 +132,7 @@
 
 </%def>
 
-<%def name="render(id=None, data=None, afterRender='void(0)')">
-  <div id="${id}" class="hue-tree" data-bind="template: { name: 'tree-template', data: ${data}, afterRender: ${afterRender} }"></div>
+<%def name="render(id=None, data=None, afterRender='void(0)', component='')">
+  <div id="${id}" class="hue-tree" data-bind="template: { name: 'tree-template${ component }', data: ${data}, afterRender: ${afterRender} }"></div>
 </%def>
 

+ 2 - 1
desktop/core/src/desktop/templates/hue.mako

@@ -593,7 +593,8 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
           'home', 'oozie_workflow', 'oozie_coordinator', 'oozie_bundle', 'dashboard', 'metastore',
           'filebrowser', 'useradmin_users', 'useradmin_groups', 'useradmin_newgroup', 'useradmin_editgroup',
           'useradmin_permissions', 'useradmin_editpermission', 'useradmin_configurations', 'useradmin_newuser',
-          'useradmin_addldapusers', 'useradmin_addldapgroups', 'useradmin_edituser', 'importer'
+          'useradmin_addldapusers', 'useradmin_addldapgroups', 'useradmin_edituser', 'importer',
+          'security_hive', 'security_hdfs', 'security_hive2', 'security_solr'
       ];
 
       var OnePageViewModel = function () {