Przeglądaj źródła

[frontend] Add a "use_new_assist_panel" feature flag

This also removes the old use_new_side_panels flag
Johan Ahlen 4 lat temu
rodzic
commit
324a4bad21

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

@@ -210,9 +210,6 @@
   # Choose whether to enable SQL syntax check or not
   ## enable_sql_syntax_check=true
 
-  # Choose whether to show the improved assist panel and the right context panel
-  ## use_new_side_panels=false
-
   # Choose whether to use new charting library across the whole Hue.
   ## use_new_charts=false
 

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

@@ -214,9 +214,6 @@
   # Choose whether to enable the new SQL syntax checker or not
   ## enable_sql_syntax_check=true
 
-  # Choose whether to show the improved assist panel and the right context panel
-  ## use_new_side_panels=false
-
   # Choose whether to use new charting library across the whole Hue.
   ## use_new_charts=false
 

+ 4 - 4
desktop/core/src/desktop/conf.py

@@ -1739,11 +1739,11 @@ DJANGO_DEBUG_TOOL_USERS = Config(
   help=_('Comma separated list of users that allow to use django debug tool. If it is empty, all users are allowed.')
 )
 
-USE_NEW_SIDE_PANELS = Config( # To remove in Hue 4
-  key='use_new_side_panels',
-  default=True,
+USE_NEW_ASSIST_PANEL = Config(
+  key='use_new_assist_panel',
+  default=False,
   type=coerce_bool,
-  help=_('Choose whether to show extended left and right panels.')
+  help=_('Choose whether to show the new Assist panel or the old.')
 )
 
 USE_DEFAULT_CONFIGURATION = Config(

+ 1 - 0
desktop/core/src/desktop/js/components/ComboBox.vue

@@ -28,6 +28,7 @@
     (option as { label: string }).label || (option as string);
 
   export default defineComponent({
+    name: 'ComboBox',
     components: { DropdownMenuOptions, TypeaheadInput },
     props: {
       modelValue: {

+ 112 - 116
desktop/core/src/desktop/js/ko/components/assist/ko.assistPanel.js

@@ -86,8 +86,6 @@ class AssistPanel {
       errorLoadingTablePreview: I18n('There was a problem loading the index preview')
     };
 
-    self.tabsEnabled = window.USE_NEW_SIDE_PANELS;
-
     self.availablePanels = ko.observableArray();
     self.visiblePanel = ko.observable();
 
@@ -125,138 +123,136 @@ class AssistPanel {
           });
         }
 
-        if (self.tabsEnabled) {
-          if (appConfig.browser && appConfig.browser.interpreters) {
-            const storageBrowsers = appConfig.browser.interpreters.filter(
-              interpreter =>
-                interpreter.type === 'adls' ||
-                interpreter.type === 'hdfs' ||
-                interpreter.type === 's3' ||
-                interpreter.type === 'abfs'
-            );
-
-            if (storageBrowsers.length) {
-              panels.push(
-                new AssistInnerPanel({
-                  panelData: {
-                    name: 'hue-assist-storage-panel',
-                    params: {
-                      sources: storageBrowsers
-                    }
-                  },
-                  name: I18n('Files'),
-                  type: 'files',
-                  icon: 'fa-files-o',
-                  minHeight: 50
-                })
-              );
-            }
-
-            if (appConfig.browser.interpreter_names.indexOf('indexes') !== -1) {
-              const solrPanel = new AssistInnerPanel({
-                panelData: {
-                  name: 'hue-assist-db-panel',
-                  params: $.extend(
-                    {
-                      i18n: i18nCollections,
-                      isSolr: true
-                    },
-                    params.sql
-                  )
-                },
-                name: I18n('Indexes'),
-                type: 'solr',
-                icon: 'fa-search-plus',
-                minHeight: 75
-              });
-              panels.push(solrPanel);
-              huePubSub.subscribe(ASSIST_SHOW_SOLR_EVENT, () => {
-                if (self.visiblePanel() !== solrPanel) {
-                  self.visiblePanel(solrPanel);
-                }
-              });
-            }
+        if (appConfig.browser && appConfig.browser.interpreters) {
+          const storageBrowsers = appConfig.browser.interpreters.filter(
+            interpreter =>
+              interpreter.type === 'adls' ||
+              interpreter.type === 'hdfs' ||
+              interpreter.type === 's3' ||
+              interpreter.type === 'abfs'
+          );
 
-            if (appConfig.browser.interpreter_names.indexOf('kafka') !== -1) {
-              const streamsPanel = new AssistInnerPanel({
+          if (storageBrowsers.length) {
+            panels.push(
+              new AssistInnerPanel({
                 panelData: {
-                  name: 'hue-assist-db-panel',
-                  params: $.extend(
-                    {
-                      i18n: i18nCollections,
-                      isStreams: true
-                    },
-                    params.sql
-                  )
+                  name: 'hue-assist-storage-panel',
+                  params: {
+                    sources: storageBrowsers
+                  }
                 },
-                name: I18n('Streams'),
-                type: 'kafka',
-                icon: 'fa-sitemap',
-                minHeight: 75
-              });
-              panels.push(streamsPanel);
-            }
-
-            if (appConfig.browser.interpreter_names.indexOf('hbase') !== -1) {
-              panels.push(
-                new AssistInnerPanel({
-                  panelData: {
-                    name: 'hue-assist-hbase-panel',
-                    params: {}
-                  },
-                  name: I18n('HBase'),
-                  type: 'hbase',
-                  icon: 'fa-th-large',
-                  minHeight: 50
-                })
-              );
-            }
+                name: I18n('Files'),
+                type: 'files',
+                icon: 'fa-files-o',
+                minHeight: 50
+              })
+            );
           }
 
-          const documentsPanel = new AssistInnerPanel({
-            panelData: {
-              name: 'hue-assist-documents-panel',
-              params: {
-                user: params.user
+          if (appConfig.browser.interpreter_names.indexOf('indexes') !== -1) {
+            const solrPanel = new AssistInnerPanel({
+              panelData: {
+                name: 'hue-assist-db-panel',
+                params: $.extend(
+                  {
+                    i18n: i18nCollections,
+                    isSolr: true
+                  },
+                  params.sql
+                )
+              },
+              name: I18n('Indexes'),
+              type: 'solr',
+              icon: 'fa-search-plus',
+              minHeight: 75
+            });
+            panels.push(solrPanel);
+            huePubSub.subscribe(ASSIST_SHOW_SOLR_EVENT, () => {
+              if (self.visiblePanel() !== solrPanel) {
+                self.visiblePanel(solrPanel);
               }
-            },
-            name: I18n('Documents'),
-            type: 'documents',
-            icon: 'fa-files-o',
-            iconSvg: '#hi-documents',
-            minHeight: 50,
-            rightAlignIcon: true,
-            visible:
-              params.visibleAssistPanels && params.visibleAssistPanels.indexOf('documents') !== -1
-          });
-
-          panels.push(documentsPanel);
+            });
+          }
 
-          huePubSub.subscribe(ASSIST_SHOW_DOC_EVENT, docType => {
-            huePubSub.publish(SHOW_LEFT_ASSIST_EVENT);
-            if (self.visiblePanel() !== documentsPanel) {
-              self.visiblePanel(documentsPanel);
-            }
-            huePubSub.publish('assist.documents.set.type.filter', docType);
-          });
+          if (appConfig.browser.interpreter_names.indexOf('kafka') !== -1) {
+            const streamsPanel = new AssistInnerPanel({
+              panelData: {
+                name: 'hue-assist-db-panel',
+                params: $.extend(
+                  {
+                    i18n: i18nCollections,
+                    isStreams: true
+                  },
+                  params.sql
+                )
+              },
+              name: I18n('Streams'),
+              type: 'kafka',
+              icon: 'fa-sitemap',
+              minHeight: 75
+            });
+            panels.push(streamsPanel);
+          }
 
-          if (window.HAS_GIT) {
+          if (appConfig.browser.interpreter_names.indexOf('hbase') !== -1) {
             panels.push(
               new AssistInnerPanel({
                 panelData: {
-                  name: 'hue-assist-git-panel',
+                  name: 'hue-assist-hbase-panel',
                   params: {}
                 },
-                name: I18n('Git'),
-                type: 'git',
-                icon: 'fa-github',
-                minHeight: 50,
-                rightAlignIcon: true
+                name: I18n('HBase'),
+                type: 'hbase',
+                icon: 'fa-th-large',
+                minHeight: 50
               })
             );
           }
         }
 
+        const documentsPanel = new AssistInnerPanel({
+          panelData: {
+            name: 'hue-assist-documents-panel',
+            params: {
+              user: params.user
+            }
+          },
+          name: I18n('Documents'),
+          type: 'documents',
+          icon: 'fa-files-o',
+          iconSvg: '#hi-documents',
+          minHeight: 50,
+          rightAlignIcon: true,
+          visible:
+            params.visibleAssistPanels && params.visibleAssistPanels.indexOf('documents') !== -1
+        });
+
+        panels.push(documentsPanel);
+
+        huePubSub.subscribe(ASSIST_SHOW_DOC_EVENT, docType => {
+          huePubSub.publish(SHOW_LEFT_ASSIST_EVENT);
+          if (self.visiblePanel() !== documentsPanel) {
+            self.visiblePanel(documentsPanel);
+          }
+          huePubSub.publish('assist.documents.set.type.filter', docType);
+        });
+
+        if (window.HAS_GIT) {
+          panels.push(
+            new AssistInnerPanel({
+              panelData: {
+                name: 'hue-assist-git-panel',
+                params: {}
+              },
+              name: I18n('Git'),
+              type: 'git',
+              icon: 'fa-github',
+              minHeight: 50,
+              rightAlignIcon: true
+            })
+          );
+        }
+
         self.availablePanels(panels);
       } else {
         self.availablePanels([

+ 2 - 2
desktop/core/src/desktop/templates/global_js_constants.mako

@@ -20,7 +20,7 @@
   from desktop import conf
   from desktop.auth.backend import is_admin, is_hue_admin
   from desktop.conf import APP_SWITCHER_ALTUS_BASE_URL, APP_SWITCHER_MOW_BASE_URL, CUSTOM_DASHBOARD_URL, \
-      DISPLAY_APP_SWITCHER, IS_K8S_ONLY, IS_MULTICLUSTER_ONLY, USE_DEFAULT_CONFIGURATION, USE_NEW_SIDE_PANELS, \
+      DISPLAY_APP_SWITCHER, IS_K8S_ONLY, IS_MULTICLUSTER_ONLY, USE_DEFAULT_CONFIGURATION, USE_NEW_ASSIST_PANEL, \
       VCS, ENABLE_GIST, ENABLE_LINK_SHARING, has_channels, has_connectors
   from desktop.models import hue_version, _get_apps, get_cluster_config
 
@@ -672,7 +672,7 @@
       home_dir = '/'
   %>
 
-  window.USE_NEW_SIDE_PANELS = '${ USE_NEW_SIDE_PANELS.get() }' === 'True'
+  window.USE_NEW_ASSIST_PANEL = '${ USE_NEW_ASSIST_PANEL.get() }' === 'True'
   window.USER_HOME_DIR = '${ home_dir }';
 
   var userGroups = [];