Browse Source

HUE-8330 [assist] Use workload analytics config flag in the UI

Johan Ahlen 7 years ago
parent
commit
950a22b4b4

+ 8 - 2
desktop/core/src/desktop/templates/assist.mako

@@ -2486,7 +2486,7 @@ from desktop.views import _ko
 
         <!-- ko if: HAS_OPTIMIZER && !isSolr() -->
         <div class="assist-flex-header assist-divider"><div class="assist-inner-header">${ _('Query Analysis') }</div></div>
-        <div data-bind="css: IS_MULTICLUSTER_ONLY ? 'assist-flex-quarter' : 'assist-flex-half'">
+        <div data-bind="css: HAS_WORKLOAD_ANALYTICS ? 'assist-flex-quarter' : 'assist-flex-half'">
           <!-- ko if: ! activeRisks().hints -->
           <div class="assist-no-entries">${ _('Select a query or start typing to get optimization hints.') }</div>
           <!-- /ko -->
@@ -2517,7 +2517,7 @@ from desktop.views import _ko
         </div>
         <!-- /ko -->
 
-        <!-- ko if: IS_MULTICLUSTER_ONLY && !isSolr() -->
+        <!-- ko if: HAS_WORKLOAD_ANALYTICS && !isSolr() -->
           <div class="assist-flex-header" data-bind="css: { 'assist-divider': !HAS_OPTIMIZER }"><div class="assist-inner-header">${ _('Execution Analysis') }</div></div>
           <div data-bind="css: HAS_OPTIMIZER ? 'assist-flex-quarter' : 'assist-flex-half'">
           <!-- ko hueSpinner: { spin: loadingExecutionAnalysis, inline: true} --><!-- /ko -->
@@ -2961,10 +2961,16 @@ from desktop.views import _ko
         });
 
         var clearAnalysisSub = huePubSub.subscribe('assist.clear.execution.analysis', function() {
+          if (!HAS_WORKLOAD_ANALYTICS) {
+            return;
+          }
           self.executionAnalysis(undefined);
         });
 
         var executionAnalysisSub = huePubSub.subscribe('assist.update.execution.analysis', function (details) {
+          if (!HAS_WORKLOAD_ANALYTICS) {
+            return;
+          }
           self.loadingExecutionAnalysis(true);
           ApiHelper.getInstance().fetchQueryExecutionAnalysis({
             silenceErrors: true,

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

@@ -23,7 +23,7 @@
 
   from beeswax.conf import LIST_PARTITIONS_LIMIT
   from indexer.conf import ENABLE_NEW_INDEXER
-  from metadata.conf import has_navigator, has_optimizer, OPTIMIZER
+  from metadata.conf import has_navigator, has_optimizer, has_workload_analytics, OPTIMIZER
 %>
 
 (function () {
@@ -48,7 +48,7 @@
 
   window.HAS_OPTIMIZER = '${ has_optimizer() }' === 'True';
 
-  window.IS_MULTICLUSTER_ONLY = '${ conf.IS_MULTICLUSTER_ONLY.get() }' === 'True';
+  window.HAS_WORKLOAD_ANALYTICS = '${ has_workload_analytics() }' === 'True';
 
   window.HUE_CONTAINER = '${ IS_EMBEDDED.get() }' === 'True' ? '.hue-embedded-container' : 'body';