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

HUE-8841 [frontend] Rename HAS_NAVIGATOR to HAS_CATALOG

Johan Ahlen 6 жил өмнө
parent
commit
b5e9bd6371

+ 1 - 1
.eslintrc.js

@@ -4,7 +4,7 @@ const normalGlobals = [];
 const hueGlobals = [
   // global_js_constants.mako
   'AUTOCOMPLETE_TIMEOUT', 'CACHEABLE_TTL', 'CSRF_TOKEN', 'DOCUMENT_TYPES', 'DROPZONE_HOME_DIR',
-  'ENABLE_SQL_SYNTAX_CHECK', 'HAS_MULTI_CLUSTER', 'HAS_NAVIGATOR', 'HAS_OPTIMIZER', 'HAS_WORKLOAD_ANALYTICS',
+  'ENABLE_SQL_SYNTAX_CHECK', 'HAS_MULTI_CLUSTER', 'HAS_CATALOG', 'HAS_OPTIMIZER', 'HAS_WORKLOAD_ANALYTICS',
   'HUE_CONTAINER', 'HUE_I18n', 'HUE_VERSION', 'IS_EMBEDDED', 'IS_K8S_ONLY', 'IS_NEW_INDEXER_ENABLED', 'IS_S3_ENABLED',
   'isIE11', 'KO_DATERANGEPICKER_LABELS', 'LOGGED_USERGROUPS', 'LOGGED_USERNAME', 'METASTORE_PARTITION_LIMIT',
   'USER_HOME_DIR', 'WorkerGlobalScope',

+ 1 - 1
apps/metastore/src/metastore/templates/metastore.mako

@@ -1059,7 +1059,7 @@ ${ components.menubar(is_embeddable) }
       var options = {
         user: '${ user.username }',
         optimizerEnabled: '${ is_optimizer_enabled }' === 'True',
-        navigatorEnabled: '${ is_navigator_enabled }' === 'True',
+        navigatorEnabled: window.HAS_CATALOG,
         optimizerUrl: '${ optimizer_url }',
         navigatorUrl: '${ navigator_url }',
         sourceType: '${ source_type }'

+ 4 - 1
desktop/core/src/desktop/js/apps/notebook/app.js

@@ -911,7 +911,10 @@ huePubSub.subscribe('app.dom.loaded', app => {
         if (app === 'editor') {
           huePubSub.publish('redraw.fixed.headers');
           huePubSub.publish('hue.scrollleft.show');
-          huePubSub.publish('active.snippet.type.changed', { type: viewModel.editorType(), isSqlDialect: viewModel.getSnippetViewSettings(viewModel.editorType()).sqlDialect });
+          huePubSub.publish('active.snippet.type.changed', {
+            type: viewModel.editorType(),
+            isSqlDialect: viewModel.getSnippetViewSettings(viewModel.editorType()).sqlDialect
+          });
         }
       },
       HUE_PUB_SUB_EDITOR_ID

+ 14 - 3
desktop/core/src/desktop/js/apps/notebook/editorViewModel.js

@@ -560,7 +560,10 @@ class EditorViewModel {
             if (typeof skipUrlChange === 'undefined' && !self.isNotificationManager()) {
               if (self.editorMode()) {
                 self.editorType(data.document.type.substring('query-'.length));
-                huePubSub.publish('active.snippet.type.changed', { type: self.editorType(), isSqlDialect: self.getSnippetViewSettings(self.editorType()).sqlDialect });
+                huePubSub.publish('active.snippet.type.changed', {
+                  type: self.editorType(),
+                  isSqlDialect: self.getSnippetViewSettings(self.editorType()).sqlDialect
+                });
                 self.changeURL(
                   self.URLS.editor + '?editor=' + data.document.id + '&type=' + self.editorType()
                 );
@@ -583,7 +586,10 @@ class EditorViewModel {
     };
 
     self.newNotebook = function(editorType, callback, queryTab) {
-      huePubSub.publish('active.snippet.type.changed', { type: editorType, isSqlDialect: editorType ? self.getSnippetViewSettings(editorType).sqlDialect : undefined  });
+      huePubSub.publish('active.snippet.type.changed', {
+        type: editorType,
+        isSqlDialect: editorType ? self.getSnippetViewSettings(editorType).sqlDialect : undefined
+      });
       $.post(
         '/notebook/api/create_notebook',
         {
@@ -604,7 +610,12 @@ class EditorViewModel {
             if (window.location.getParameter('type') === '') {
               hueUtils.changeURLParameter('type', self.editorType());
             }
-            huePubSub.publish('active.snippet.type.changed', { type: editorType, isSqlDialect: editorType ? self.getSnippetViewSettings(editorType).sqlDialect : undefined  });
+            huePubSub.publish('active.snippet.type.changed', {
+              type: editorType,
+              isSqlDialect: editorType
+                ? self.getSnippetViewSettings(editorType).sqlDialect
+                : undefined
+            });
           }
 
           if (typeof callback !== 'undefined' && callback !== null) {

+ 4 - 1
desktop/core/src/desktop/js/apps/notebook/snippet.js

@@ -222,7 +222,10 @@ class Snippet {
 
     self.inFocus.subscribe(newValue => {
       if (newValue) {
-        huePubSub.publish('active.snippet.type.changed', { type: self.type(), isSqlDialect: self.isSqlDialect() });
+        huePubSub.publish('active.snippet.type.changed', {
+          type: self.type(),
+          isSqlDialect: self.isSqlDialect()
+        });
       }
     });
 

+ 14 - 3
desktop/core/src/desktop/js/apps/notebook2/editorViewModel.js

@@ -436,7 +436,10 @@ class EditorViewModel {
 
   newNotebook(editorType, callback, queryTab) {
     const self = this;
-    huePubSub.publish('active.snippet.type.changed', { type: editorType, isSqlDialect: editorType ? self.getSnippetViewSettings(editorType).sqlDialect : undefined });
+    huePubSub.publish('active.snippet.type.changed', {
+      type: editorType,
+      isSqlDialect: editorType ? self.getSnippetViewSettings(editorType).sqlDialect : undefined
+    });
     $.post(
       '/notebook/api/create_notebook',
       {
@@ -457,7 +460,12 @@ class EditorViewModel {
           if (window.location.getParameter('type') === '') {
             hueUtils.changeURLParameter('type', self.editorType());
           }
-          huePubSub.publish('active.snippet.type.changed', { type: editorType, isSqlDialect: editorType ? self.getSnippetViewSettings(editorType).sqlDialect : undefined });
+          huePubSub.publish('active.snippet.type.changed', {
+            type: editorType,
+            isSqlDialect: editorType
+              ? self.getSnippetViewSettings(editorType).sqlDialect
+              : undefined
+          });
         }
 
         if (typeof callback !== 'undefined' && callback !== null) {
@@ -486,7 +494,10 @@ class EditorViewModel {
           if (typeof skipUrlChange === 'undefined' && !self.isNotificationManager()) {
             if (self.editorMode()) {
               self.editorType(data.document.type.substring('query-'.length));
-              huePubSub.publish('active.snippet.type.changed', { type: self.editorType(), isSqlDialect: self.getSnippetViewSettings(self.editorType()).sqlDialect });
+              huePubSub.publish('active.snippet.type.changed', {
+                type: self.editorType(),
+                isSqlDialect: self.getSnippetViewSettings(self.editorType()).sqlDialect
+              });
               self.changeURL(
                 self.URLS.editor + '?editor=' + data.document.id + '&type=' + self.editorType()
               );

+ 4 - 1
desktop/core/src/desktop/js/apps/notebook2/snippet.js

@@ -212,7 +212,10 @@ class Snippet {
 
     self.inFocus.subscribe(newValue => {
       if (newValue) {
-        huePubSub.publish('active.snippet.type.changed', { type: self.type(), isSqlDialect: self.isSqlDialect() });
+        huePubSub.publish('active.snippet.type.changed', {
+          type: self.type(),
+          isSqlDialect: self.isSqlDialect()
+        });
       }
     });
 

+ 1 - 1
desktop/core/src/desktop/js/catalog/dataCatalogEntry.js

@@ -769,7 +769,7 @@ class DataCatalogEntry {
   canHaveNavigatorMetadata() {
     const self = this;
     return (
-      window.HAS_NAVIGATOR &&
+      window.HAS_CATALOG &&
       (self.getSourceType() === 'hive' || self.getSourceType() === 'impala') &&
       (self.isDatabase() || self.isTableOrView() || self.isColumn())
     );

+ 1 - 1
desktop/core/src/desktop/js/catalog/generalDataCatalog.js

@@ -47,7 +47,7 @@ class GeneralDataCatalog {
 
     const deferred = $.Deferred();
 
-    if (!window.HAS_NAVIGATOR) {
+    if (!window.HAS_CATALOG) {
       return deferred.reject().promise();
     }
 

+ 1 - 1
desktop/core/src/desktop/js/ko/components/contextPopover/ko.contextPopover.js

@@ -404,7 +404,7 @@ const SUPPORT_TEMPLATES = `
           <!-- /ko -->
   
           <!-- ko ifnot: $parent.commentExpanded -->
-              <!-- ko if: window.HAS_NAVIGATOR && !isTemporary && (getSourceType() === 'hive' || getSourceType() === 'impala') -->
+              <!-- ko if: window.HAS_CATALOG && !isTemporary && (getSourceType() === 'hive' || getSourceType() === 'impala') -->
               <div data-bind="component: { name: 'nav-tags', params: { catalogEntry: $data, overflowEllipsis: true } }"></div>
               <!-- /ko -->
   

+ 2 - 2
desktop/core/src/desktop/js/ko/components/ko.globalSearch.js

@@ -53,7 +53,7 @@ const TEMPLATE = `
       facetDropDownVisible: facetDropDownVisible,
       spin: loading,
       placeHolder: '${I18n(
-        window.HAS_NAVIGATOR ? 'Search data and saved documents...' : 'Search saved documents...'
+        window.HAS_CATALOG ? 'Search data and saved documents...' : 'Search saved documents...'
       )}',
       querySpec: querySpec,
       onClear: function () { selectedIndex(null); searchResultVisible(false); },
@@ -519,7 +519,7 @@ class GlobalSearch {
         })
     );
 
-    if (!docOnly && HAS_NAVIGATOR) {
+    if (!docOnly && window.HAS_CATALOG) {
       const clearNavTimeout = window.setTimeout(() => {
         self.updateCategories(NAV_CATEGORY, []);
       }, 300);

+ 1 - 3
desktop/core/src/desktop/js/sidePanelViewModel.js

@@ -70,9 +70,7 @@ class SidePanelViewModel {
     });
 
     huePubSub.subscribe('active.snippet.type.changed', details => {
-      self.rightAssistAvailable(
-        details.isSqlDialect || details.type === 'pig'
-      );
+      self.rightAssistAvailable(details.isSqlDialect || details.type === 'pig');
     });
 
     huePubSub.publish('get.current.app.name');

+ 1 - 1
desktop/core/src/desktop/templates/assist.mako

@@ -19,7 +19,7 @@ from django.utils.translation import ugettext as _
 
 from dashboard.conf import HAS_SQL_ENABLED
 from filebrowser.conf import SHOW_UPLOAD_BUTTON
-from metadata.conf import has_catalog, OPTIMIZER
+from metadata.conf import OPTIMIZER
 from metastore.conf import ENABLE_NEW_CREATE_TABLE
 from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, get_ordered_interpreters
 

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

@@ -62,7 +62,7 @@
 
   window.ENABLE_SQL_SYNTAX_CHECK = '${ conf.ENABLE_SQL_SYNTAX_CHECK.get() }' === 'True';
 
-  window.HAS_NAVIGATOR = '${ has_catalog(request.user) }' === 'True';
+  window.HAS_CATALOG = '${ has_catalog(request.user) }' === 'True';
 
   window.HAS_OPTIMIZER = '${ has_optimizer() }' === 'True';
 
@@ -384,4 +384,4 @@
   };
 
   ${ impalaDocIndex.impalaDocIndex() }
-})();
+})();