Bläddra i källkod

HUE-4859 [editor] Add a config flag to enable the extended assist panel and the right context panel

Johan Ahlen 9 år sedan
förälder
incheckning
fe5771cadc

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -160,6 +160,9 @@
   # Choose whether to show the new SQL editor.
   ## use_new_editor=true
 
+  # Choose whether to show the improved assist panel and the right context panel
+  ## use_new_side_panels=false
+
   # Editor autocomplete timeout (ms) when fetching columns, fields, tables etc.
   # To disable this type of autocompletion set the value to 0
   ## editor_autocomplete_timeout=5000

+ 3 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -164,6 +164,9 @@
   # Choose whether to show the new SQL editor.
   ## use_new_editor=true
 
+  # Choose whether to show the improved assist panel and the right context panel
+  ## use_new_side_panels=false
+
   # Editor autocomplete timeout (ms) when fetching columns, fields, tables etc.
   # To disable this type of autocompletion set the value to 0
   ## editor_autocomplete_timeout=5000

+ 7 - 0
desktop/core/src/desktop/conf.py

@@ -1192,6 +1192,13 @@ USE_NEW_EDITOR = Config( # To remove in Hue 4
   help=_('Choose whether to show the new SQL editor.')
 )
 
+USE_NEW_SIDE_PANELS = Config( # To remove in Hue 4
+  key='use_new_side_panels',
+  default=False,
+  type=coerce_bool,
+  help=_('Choose whether to show extended left and right panels.')
+)
+
 USE_DEFAULT_CONFIGURATION = Config(
   key='use_default_configuration',
   default=False,

+ 32 - 26
desktop/core/src/desktop/templates/assist.mako

@@ -16,9 +16,10 @@
 
 <%!
 from desktop import conf
+from desktop.conf import USE_NEW_SIDE_PANELS
 from desktop.lib.i18n import smart_unicode
-from django.utils.translation import ugettext as _
 from desktop.views import _ko
+from django.utils.translation import ugettext as _
 from metadata.conf import has_navigator
 %>
 
@@ -816,6 +817,7 @@ from metadata.conf import has_navigator
   <script type="text/html" id="assist-panel-template">
     <div style="display: flex; flex-direction: column; position:relative; height: 100%; overflow: hidden;">
       <!-- ko template: { if: navigatorEnabled, name: 'assist-panel-navigator-search' }--><!-- /ko -->
+      <!-- ko if: availablePanels.length > 1 -->
       <div style="position: relative; flex: 0 0 29px;" class="assist-panel-switches">
         <!-- ko foreach: availablePanels -->
         <div class="inactive-action assist-type-switch" data-bind="click: function () { $parent.visiblePanel($data); }, css: { 'blue': $parent.visiblePanel() === $data }, attr: { 'title': name }">
@@ -823,7 +825,8 @@ from metadata.conf import has_navigator
         </div>
         <!-- /ko -->
       </div>
-      <div style="position: relative; flex: 1 1 100%; overflow: hidden;padding-top: 10px;" data-bind="with: visiblePanel">
+      <!-- /ko -->
+      <div style="position: relative; flex: 1 1 100%; overflow: hidden; padding-top: 10px;" data-bind="style: { 'padding-top': availablePanels.length > 1 ? '10px' : '5px' }, with: visiblePanel">
         <!-- ko template: { name: templateName, data: panelData } --><!-- /ko -->
       </div>
     </div>
@@ -1253,33 +1256,36 @@ from metadata.conf import has_navigator
             type: 'db',
             icon: 'fa-database',
             minHeight: 75
-          }),
-          new AssistInnerPanel({
-            panelData: new AssistHdfsPanel({
-              apiHelper: self.apiHelper
-            }),
-            apiHelper: self.apiHelper,
-            name: '${ _("HDFS") }',
-            type: 'hdfs',
-            icon: 'fa-folder-o',
-            minHeight: 50
           })
-##           }),
-##           new AssistInnerPanel({
-##             panelData: new AssistDocumentsPanel({
-##               user: params.user,
-##               apiHelper: self.apiHelper,
-##               i18n: i18n
-##             }),
-##             apiHelper: self.apiHelper,
-##             name: '${ _("Documents") }',
-##             type: 'documents',
-##             icon: 'fa-files-o',
-##             minHeight: 50,
-##             visible: params.visibleAssistPanels && params.visibleAssistPanels.indexOf('documents') !== -1
-##           })
         ];
 
+        % if USE_NEW_SIDE_PANELS.get():
+        self.availablePanels.push(new AssistInnerPanel({
+          panelData: new AssistHdfsPanel({
+            apiHelper: self.apiHelper
+          }),
+          apiHelper: self.apiHelper,
+          name: '${ _("HDFS") }',
+          type: 'hdfs',
+          icon: 'fa-folder-o',
+          minHeight: 50
+        }));
+
+##         self.availablePanels.push(new AssistInnerPanel({
+##           panelData: new AssistDocumentsPanel({
+##             user: params.user,
+##             apiHelper: self.apiHelper,
+##             i18n: i18n
+##           }),
+##           apiHelper: self.apiHelper,
+##           name: '${ _("Documents") }',
+##           type: 'documents',
+##           icon: 'fa-files-o',
+##           minHeight: 50,
+##           visible: params.visibleAssistPanels && params.visibleAssistPanels.indexOf('documents') !== -1
+##         }));
+        % endif
+
         self.performSearch = function () {
           if (self.searchInput() === lastQuery) {
             return;