Просмотр исходного кода

HUE-9388 [search] Disable webworkers in the dashboard ace editor

Johan Ahlen 5 лет назад
Родитель
Сommit
dd13bbacf8

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

@@ -152,7 +152,7 @@ class SimpleAceEditor {
         inFocus: ko.observable()
       };
 
-      if (connector.is_sql) {
+      if (connector.is_sql && !params.disableWorkers) {
         sqlWorkerHandler.registerWorkers();
         const aceLocationHandler = new AceLocationHandler({
           editor: editor,

+ 4 - 0
desktop/libs/dashboard/src/dashboard/static/dashboard/js/search.ko.js

@@ -565,6 +565,10 @@ var Collection = function (vm, collection) {
     self.activeCompute(context.namespaces[0].computes[0]);
   });
 
+  self.simpleAceDatabase = ko.pureComputed(function () {
+    return self.name().split('.')[0];
+  });
+
   self.engine = ko.observable(typeof collection.engine != "undefined" && collection.engine != null ? collection.engine : "solr");
   self.engine.subscribe(function() {
     self.name(null);

+ 4 - 2
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -109,7 +109,8 @@ from dashboard.conf import USE_GRIDSTER, USE_NEW_ADD_METHOD, HAS_REPORT_ENABLED,
               fixedPostfix: $root.collection.engine() !== 'solr' ? function() { return ' GROUP BY 1;' } : undefined,
               namespace: $root.collection.activeNamespace,
               compute: $root.collection.activeCompute,
-              database: function () { return $root.collection.name().split('.')[0] },
+              database: $root.collection.simpleAceDatabase,
+              disableWorkers: true,
               singleLine: true }
             }"></div>
 ##             <input data-bind="clearable: q, valueUpdate:'afterkeydown', typeahead: { target: q, nonBindableSource: queryTypeahead, multipleValues: true, multipleValuesSeparator: ':', extraKeywords: 'AND OR TO', completeSolrRanges: true }, css: {'input-small': $root.query.qs().length > 1, 'flat-left': $index() === 0, 'input-xlarge': $root.collection.supportAnalytics()}" maxlength="4096" type="text" class="search-query">
@@ -2182,7 +2183,8 @@ ${ dashboard.layout_skeleton(suffix='search') }
         fixedPostfix: $root.collection.engine() !== 'solr' ? function() { return ' GROUP BY 1;' } : undefined,
         namespace: $root.collection.activeNamespace,
         compute: $root.collection.activeCompute,
-        database: function () { return $root.collection.name().split('.')[0] },
+        database: $root.collection.simpleAceDatabase,
+        disableWorkers: true,
         singleLine: true }
       }"></div>
     </span>