Quellcode durchsuchen

HUE-8945 [core] Avoid 500 when blacklisting zookeeper,proxy,rdbms,indexer

Romain vor 6 Jahren
Ursprung
Commit
a6ea8a9549
1 geänderte Dateien mit 13 neuen und 12 gelöschten Zeilen
  1. 13 12
      desktop/core/src/desktop/templates/global_js_constants.mako

+ 13 - 12
desktop/core/src/desktop/templates/global_js_constants.mako

@@ -34,13 +34,17 @@
 
 <%namespace name="sqlDocIndex" file="/sql_doc_index.mako" />
 (function () {
+  <%
+    apps = _get_apps(user)
+  %>
+
   window.AUTOCOMPLETE_TIMEOUT = ${ conf.EDITOR_AUTOCOMPLETE_TIMEOUT.get() };
 
   window.BANNER_TOP_HTML = '${ conf.CUSTOM.BANNER_TOP_HTML.get() }';
 
   window.CACHEABLE_TTL = {
     default: ${ conf.CUSTOM.CACHEABLE_TTL.get() },
-    optimizer: ${ OPTIMIZER.CACHEABLE_TTL.get() }
+    optimizer: ${ hasattr(OPTIMIZER, 'ConfigSection') and OPTIMIZER.CACHEABLE_TTL.get() or 0 }
   };
 
   window.DEV = '${ conf.DEV.get() }' === 'True';
@@ -80,13 +84,13 @@
 
   window.ENABLE_SQL_SYNTAX_CHECK = '${ conf.ENABLE_SQL_SYNTAX_CHECK.get() }' === 'True';
 
-  window.HAS_CATALOG = '${ has_catalog(request.user) }' === 'True';
-  window.CATALOG_URL = '${ get_catalog_url() }'
-  window.HAS_READ_ONLY_CATALOG = '${ has_readonly_catalog(request.user) }' === 'True' || '${ has_write_access(request.user) }' === 'False';
+  window.HAS_CATALOG = '${ 'metadata' in apps and has_catalog(request.user) }' === 'True';
+  window.CATALOG_URL = '${ 'metadata' in apps and get_catalog_url() or "" }'
+  window.HAS_READ_ONLY_CATALOG = '${ 'metadata' in apps and has_readonly_catalog(request.user) }' === 'True' || '${ has_write_access(request.user) }' === 'False';
 
-  window.HAS_OPTIMIZER = '${ has_optimizer() }' === 'True';
-  window.OPTIMIZER_URL = '${ get_optimizer_url() }'
-  window.AUTO_UPLOAD_OPTIMIZER_STATS = '${ OPTIMIZER.AUTO_UPLOAD_STATS.get() }' === 'True';
+  window.HAS_OPTIMIZER = '${ 'metadata' in apps and has_optimizer() }' === 'True';
+  window.OPTIMIZER_URL = '${ 'metadata' in apps and get_optimizer_url() }'
+  window.AUTO_UPLOAD_OPTIMIZER_STATS = '${ 'metadata' in apps and OPTIMIZER.AUTO_UPLOAD_STATS.get() }' === 'True';
 
   ## In the past was has_workload_analytics()
   window.HAS_WORKLOAD_ANALYTICS = '${ ENABLE_QUERY_ANALYSIS.get() }' === 'True';
@@ -103,12 +107,9 @@
   window.JB_SINGLE_CHECK_INTERVAL_IN_MILLIS = 5000;
   window.JB_MULTI_CHECK_INTERVAL_IN_MILLIS = 20000;
 
-  <%
-    apps = _get_apps(user)
-  %>
   window.HUE_URLS = {
-    IMPORTER_CREATE_TABLE: '${url('indexer:importer_prefill', source_type = 'all', target_type = 'table')}',
-    IMPORTER_CREATE_DATABASE: '${url('indexer:importer_prefill', source_type = 'manual', target_type = 'database')}',
+    IMPORTER_CREATE_TABLE: '${ 'indexer' in apps and url('indexer:importer_prefill', source_type = 'all', target_type = 'table')}',
+    IMPORTER_CREATE_DATABASE: '${ 'indexer' in apps and url('indexer:importer_prefill', source_type = 'manual', target_type = 'database')}',
     NOTEBOOK_INDEX: '${url('notebook:index')}',
     % if 'pig' in apps:
     PIG_INDEX: '${url('pig:index')}',