Kaynağa Gözat

HUE-9263 [assist] Consolidate assist events into constants to prevent spelling mistakes

Johan Ahlen 5 yıl önce
ebeveyn
işleme
d963142d65
40 değiştirilmiş dosya ile 200 ekleme ve 127 silme
  1. 1 1
      apps/beeswax/src/beeswax/static/beeswax/js/beeswax.vm.js
  2. 1 1
      apps/beeswax/src/beeswax/templates/execute.mako
  3. 1 1
      desktop/core/src/desktop/js/api/apiUtils.js
  4. 2 1
      desktop/core/src/desktop/js/apps/notebook/app.js
  5. 2 2
      desktop/core/src/desktop/js/apps/notebook/chartTransformers.js
  6. 8 3
      desktop/core/src/desktop/js/apps/notebook/notebook.js
  7. 12 13
      desktop/core/src/desktop/js/apps/notebook/snippet.js
  8. 2 1
      desktop/core/src/desktop/js/apps/notebook2/app.js
  9. 1 1
      desktop/core/src/desktop/js/apps/notebook2/components/resultGrid/ko.simpleResultGrid.js
  10. 8 3
      desktop/core/src/desktop/js/apps/notebook2/notebook.js
  11. 11 12
      desktop/core/src/desktop/js/apps/notebook2/snippet.js
  12. 6 2
      desktop/core/src/desktop/js/apps/table_browser/metastoreSource.js
  13. 1 1
      desktop/core/src/desktop/js/jquery/plugins/jquery.filechooser.js
  14. 1 1
      desktop/core/src/desktop/js/jquery/plugins/jquery.hdfs.autocomplete.js
  15. 1 1
      desktop/core/src/desktop/js/jquery/plugins/jquery.hdfstree.js
  16. 1 1
      desktop/core/src/desktop/js/jquery/plugins/jquery.rowselector.js
  17. 1 1
      desktop/core/src/desktop/js/ko/bindings/ace/ko.aceEditor.js
  18. 1 1
      desktop/core/src/desktop/js/ko/components/assist/assistStorageEntry.js
  19. 2 2
      desktop/core/src/desktop/js/ko/components/assist/assistStorageEntry.test.js
  20. 33 0
      desktop/core/src/desktop/js/ko/components/assist/events.js
  21. 24 21
      desktop/core/src/desktop/js/ko/components/assist/ko.assistDbPanel.js
  22. 3 2
      desktop/core/src/desktop/js/ko/components/assist/ko.assistDocumentsPanel.js
  23. 30 26
      desktop/core/src/desktop/js/ko/components/assist/ko.assistLangRefPanel.js
  24. 10 4
      desktop/core/src/desktop/js/ko/components/assist/ko.assistPanel.js
  25. 2 2
      desktop/core/src/desktop/js/ko/components/assist/ko.assistStoragePanel.js
  26. 8 3
      desktop/core/src/desktop/js/ko/components/assist/ko.rightAssistPanel.js
  27. 2 1
      desktop/core/src/desktop/js/ko/components/contextPopover/collectionContextTabs.js
  28. 2 1
      desktop/core/src/desktop/js/ko/components/contextPopover/dataCatalogContext.js
  29. 2 1
      desktop/core/src/desktop/js/ko/components/contextPopover/documentContext.js
  30. 1 1
      desktop/core/src/desktop/js/ko/components/contextPopover/ko.contextPopover.js
  31. 3 2
      desktop/core/src/desktop/js/ko/components/contextPopover/langRefContext.js
  32. 2 2
      desktop/core/src/desktop/js/ko/components/doc/ko.linkSharing.js
  33. 3 3
      desktop/core/src/desktop/js/ko/components/doc/ko.shareDocModal.js
  34. 2 1
      desktop/core/src/desktop/js/ko/components/ko.contextSelector.js
  35. 2 2
      desktop/core/src/desktop/js/ko/components/ko.editorDroppableMenu.js
  36. 2 1
      desktop/core/src/desktop/js/ko/components/ko.globalSearch.js
  37. 1 1
      desktop/core/src/desktop/js/ko/components/ko.importDocumentsModal.js
  38. 1 1
      desktop/core/src/desktop/js/ko/components/ko.sessionAuthModal.test.js
  39. 3 2
      desktop/core/src/desktop/js/sidePanelViewModel.js
  40. 1 1
      desktop/core/src/desktop/js/sql/sqlAutocompleter.test.ignore.js

+ 1 - 1
apps/beeswax/src/beeswax/static/beeswax/js/beeswax.vm.js

@@ -75,7 +75,7 @@ function BeeswaxViewModel(server, apiHelper) {
   self.database = ko.observable(null);
 
   var type = server === "beeswax" ? "hive" : "impala";
-  huePubSub.subscribe("assist.db.panel.ready", function () {
+  huePubSub.subscribe("assist.db.panel.is.ready", function () {
     // Defer to let the db be set
     window.setTimeout(function () {
       huePubSub.publish('assist.set.database', {

+ 1 - 1
apps/beeswax/src/beeswax/templates/execute.mako

@@ -2815,7 +2815,7 @@ huePubSub.subscribe("assist.database.set", handleAssistSelection);
 huePubSub.subscribe("assist.database.selected", handleAssistSelection);
 
 if (! snippet.database()) {
-  huePubSub.publish("assist.get.database", snippetType);
+  huePubSub.publish("assist.get.database", { source: snippetType, callback: handleAssistSelection });
 }
 
 shareViewModel = initSharing("#documentShareModal");

+ 1 - 1
desktop/core/src/desktop/js/api/apiUtils.js

@@ -15,7 +15,7 @@
 // limitations under the License.
 
 import $ from 'jquery';
-import hueUtils from '../utils/hueUtils';
+import hueUtils from 'utils/hueUtils';
 
 /**
  * @param {Object} [response]

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

@@ -28,6 +28,7 @@ import I18n from 'utils/i18n';
 import sqlWorkerHandler from 'sql/sqlWorkerHandler';
 import { initNotebook2 } from 'apps/notebook2/app';
 import { ACTIVE_SNIPPET_CONNECTOR_CHANGED_EVENT } from 'apps/notebook2/events';
+import { SHOW_LEFT_ASSIST_EVENT } from 'ko/components/assist/events';
 
 if (window.ENABLE_NOTEBOOK_2) {
   initNotebook2();
@@ -1039,7 +1040,7 @@ if (window.ENABLE_NOTEBOOK_2) {
       );
 
       huePubSub.subscribe(
-        'left.assist.show',
+        SHOW_LEFT_ASSIST_EVENT,
         () => {
           if (!viewModel.isLeftPanelVisible() && viewModel.assistAvailable()) {
             viewModel.isLeftPanelVisible(true);

+ 2 - 2
desktop/core/src/desktop/js/apps/notebook/chartTransformers.js

@@ -16,8 +16,8 @@
 
 import $ from 'jquery';
 
-import HueColors from '../../utils/hueColors';
-import hueUtils from '../../utils/hueUtils';
+import HueColors from 'utils/hueColors';
+import hueUtils from 'utils/hueUtils';
 
 const isNotNullForCharts = val => val !== 'NULL' && val !== null;
 

+ 8 - 3
desktop/core/src/desktop/js/apps/notebook/notebook.js

@@ -25,6 +25,11 @@ import hueUtils from 'utils/hueUtils';
 
 import Session from 'apps/notebook/session';
 import Snippet from 'apps/notebook/snippet';
+import {
+  ASSIST_DB_PANEL_IS_READY_EVENT,
+  ASSIST_IS_DB_PANEL_READY_EVENT,
+  ASSIST_SET_DATABASE_EVENT
+} from 'ko/components/assist/events';
 
 const NOTEBOOK_MAPPING = {
   ignore: [
@@ -906,7 +911,7 @@ class Notebook {
     }
 
     huePubSub.subscribeOnce(
-      'assist.db.panel.ready',
+      ASSIST_DB_PANEL_IS_READY_EVENT,
       () => {
         if (self.type().indexOf('query') === 0) {
           const whenDatabaseAvailable = function(snippet) {
@@ -915,7 +920,7 @@ class Notebook {
               'lastSelectedDb'
             );
 
-            huePubSub.publish('assist.set.database', {
+            huePubSub.publish(ASSIST_SET_DATABASE_EVENT, {
               source: snippet.type(),
               namespace: snippet.namespace(),
               name: lastSelectedDb === '' ? '' : snippet.database()
@@ -959,7 +964,7 @@ class Notebook {
       vm.huePubSubId
     );
 
-    huePubSub.publish('assist.is.db.panel.ready');
+    huePubSub.publish(ASSIST_IS_DB_PANEL_READY_EVENT);
   }
 }
 

+ 12 - 13
desktop/core/src/desktop/js/apps/notebook/snippet.js

@@ -32,6 +32,11 @@ import { SHOW_EVENT as SHOW_GIST_MODAL_EVENT } from 'ko/components/ko.shareGistM
 import { cancelActiveRequest } from 'api/apiUtils';
 import { ACTIVE_SNIPPET_CONNECTOR_CHANGED_EVENT } from 'apps/notebook2/events';
 import { findConnector } from 'utils/hueConfig';
+import {
+  ASSIST_GET_DATABASE_EVENT,
+  ASSIST_GET_SOURCE_EVENT,
+  ASSIST_SET_SOURCE_EVENT
+} from 'ko/components/assist/events';
 
 const NOTEBOOK_MAPPING = {
   ignore: [
@@ -445,17 +450,11 @@ class Snippet {
       }
     };
 
-    huePubSub.subscribeOnce(
-      'assist.source.set',
-      source => {
-        if (source !== self.type()) {
-          huePubSub.publish('assist.set.source', self.type());
-        }
-      },
-      vm.huePubSubId
-    );
-
-    huePubSub.publish('assist.get.source');
+    huePubSub.publish(ASSIST_GET_SOURCE_EVENT, source => {
+      if (source !== self.type()) {
+        huePubSub.publish(ASSIST_SET_SOURCE_EVENT, self.type());
+      }
+    });
 
     let ignoreNextAssistDatabaseUpdate = false;
     self.handleAssistSelection = function(databaseDef) {
@@ -472,9 +471,9 @@ class Snippet {
     };
 
     if (!self.database()) {
-      huePubSub.publish('assist.get.database.callback', {
+      huePubSub.publish(ASSIST_GET_DATABASE_EVENT, {
         source: self.type(),
-        callback: function(databaseDef) {
+        callback: databaseDef => {
           self.handleAssistSelection(databaseDef);
         }
       });

+ 2 - 1
desktop/core/src/desktop/js/apps/notebook2/app.js

@@ -35,6 +35,7 @@ import {
   REDRAW_CHART_EVENT
 } from 'apps/notebook2/events';
 import { DIALECT } from 'apps/notebook2/snippet';
+import { SHOW_LEFT_ASSIST_EVENT } from 'ko/components/assist/events';
 
 export const initNotebook2 = () => {
   window.Clipboard = Clipboard;
@@ -574,7 +575,7 @@ export const initNotebook2 = () => {
       );
 
       huePubSub.subscribe(
-        'left.assist.show',
+        SHOW_LEFT_ASSIST_EVENT,
         () => {
           if (!viewModel.isLeftPanelVisible() && viewModel.assistAvailable()) {
             viewModel.isLeftPanelVisible(true);

+ 1 - 1
desktop/core/src/desktop/js/apps/notebook2/components/resultGrid/ko.simpleResultGrid.js

@@ -30,7 +30,7 @@ import {
   SHOW_NORMAL_RESULT_EVENT
 } from 'apps/notebook2/events';
 import { trackResult } from 'apps/notebook2/components/executableStateHandler';
-import { EXECUTION_STATUS } from '../../execution/executable';
+import { EXECUTION_STATUS } from 'apps/notebook2/execution/executable';
 
 export const NAME = 'simple-result-grid';
 

+ 8 - 3
desktop/core/src/desktop/js/apps/notebook2/notebook.js

@@ -28,6 +28,11 @@ import Snippet, { STATUS as SNIPPET_STATUS } from 'apps/notebook2/snippet';
 import { HISTORY_CLEARED_EVENT } from 'apps/notebook2/components/ko.queryHistory';
 import { UPDATE_SAVED_QUERIES_EVENT } from 'apps/notebook2/components/ko.savedQueries';
 import SqlExecutable from './execution/sqlExecutable';
+import {
+  ASSIST_DB_PANEL_IS_READY_EVENT,
+  ASSIST_IS_DB_PANEL_READY_EVENT,
+  ASSIST_SET_DATABASE_EVENT
+} from 'ko/components/assist/events';
 
 export default class Notebook {
   constructor(vm, notebookRaw) {
@@ -129,11 +134,11 @@ export default class Notebook {
     });
 
     huePubSub.subscribeOnce(
-      'assist.db.panel.ready',
+      ASSIST_DB_PANEL_IS_READY_EVENT,
       () => {
         if (this.type().indexOf('query') === 0) {
           const whenDatabaseAvailable = function(snippet) {
-            huePubSub.publish('assist.set.database', {
+            huePubSub.publish(ASSIST_SET_DATABASE_EVENT, {
               source: snippet.dialect(),
               namespace: snippet.namespace(),
               name: snippet.database()
@@ -177,7 +182,7 @@ export default class Notebook {
       vm.huePubSubId
     );
 
-    huePubSub.publish('assist.is.db.panel.ready');
+    huePubSub.publish(ASSIST_IS_DB_PANEL_READY_EVENT);
   }
 
   addSnippet(snippetRaw) {

+ 11 - 12
desktop/core/src/desktop/js/apps/notebook2/snippet.js

@@ -46,6 +46,11 @@ import { UPDATE_HISTORY_EVENT } from 'apps/notebook2/components/ko.queryHistory'
 import { GET_KNOWN_CONFIG_EVENT, findConnector } from 'utils/hueConfig';
 import { cancelActiveRequest } from 'api/apiUtils';
 import { getOptimizer } from 'catalog/optimizer/optimizer';
+import {
+  ASSIST_GET_DATABASE_EVENT,
+  ASSIST_GET_SOURCE_EVENT,
+  ASSIST_SET_SOURCE_EVENT
+} from 'ko/components/assist/events';
 
 // TODO: Remove for ENABLE_NOTEBOOK_2. Temporary here for debug
 window.SqlExecutable = SqlExecutable;
@@ -302,22 +307,16 @@ export default class Snippet {
     this.currentQueryTab = ko.observable(snippetRaw.currentQueryTab || 'queryHistory');
     this.pinnedContextTabs = ko.observableArray(snippetRaw.pinnedContextTabs || []);
 
-    huePubSub.subscribeOnce(
-      'assist.source.set',
-      source => {
-        if (source !== this.dialect()) {
-          huePubSub.publish('assist.set.source', this.dialect());
-        }
-      },
-      this.parentVm.huePubSubId
-    );
-
-    huePubSub.publish('assist.get.source');
+    huePubSub.publish(ASSIST_GET_SOURCE_EVENT, source => {
+      if (source !== this.dialect()) {
+        huePubSub.publish(ASSIST_SET_SOURCE_EVENT, this.dialect());
+      }
+    });
 
     this.ignoreNextAssistDatabaseUpdate = false;
 
     if (!this.database()) {
-      huePubSub.publish('assist.get.database.callback', {
+      huePubSub.publish(ASSIST_GET_DATABASE_EVENT, {
         source: this.dialect(),
         callback: databaseDef => {
           this.handleAssistSelection(databaseDef);

+ 6 - 2
desktop/core/src/desktop/js/apps/table_browser/metastoreSource.js

@@ -21,6 +21,10 @@ import apiHelper from 'api/apiHelper';
 import contextCatalog from 'catalog/contextCatalog';
 import huePubSub from 'utils/huePubSub';
 import MetastoreNamespace from 'apps/table_browser/metastoreNamespace';
+import {
+  ASSIST_DB_PANEL_IS_READY_EVENT,
+  ASSIST_SET_DATABASE_EVENT
+} from 'ko/components/assist/events';
 
 class MetastoreSource {
   constructor(options) {
@@ -53,7 +57,7 @@ class MetastoreSource {
       }
     };
 
-    huePubSub.subscribe('assist.db.panel.ready', () => {
+    huePubSub.subscribe(ASSIST_DB_PANEL_IS_READY_EVENT, () => {
       this.lastLoadNamespacesDeferred.done(() => {
         let lastSelectedDb = apiHelper.getFromTotalStorage(
           'assist_' + this.sourceType + '_' + this.namespace.id,
@@ -62,7 +66,7 @@ class MetastoreSource {
         if (!lastSelectedDb && lastSelectedDb !== '') {
           lastSelectedDb = 'default';
         }
-        huePubSub.publish('assist.set.database', {
+        huePubSub.publish(ASSIST_SET_DATABASE_EVENT, {
           source: this.type,
           namespace: this.namespace().namespace,
           name: lastSelectedDb

+ 1 - 1
desktop/core/src/desktop/js/jquery/plugins/jquery.filechooser.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 import qq from 'ext/fileuploader.custom';
 
-import huePubSub from '../../utils/huePubSub';
+import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
 
 /*

+ 1 - 1
desktop/core/src/desktop/js/jquery/plugins/jquery.hdfs.autocomplete.js

@@ -16,7 +16,7 @@
 
 import $ from 'jquery';
 
-import hueUtils from '../../utils/hueUtils';
+import hueUtils from 'utils/hueUtils';
 
 /*
  * jHue HDFS autocomplete plugin

+ 1 - 1
desktop/core/src/desktop/js/jquery/plugins/jquery.hdfstree.js

@@ -16,7 +16,7 @@
 
 import jQuery from 'jquery';
 
-import hueUtils from '../../utils/hueUtils';
+import hueUtils from 'utils/hueUtils';
 import I18n from 'utils/i18n';
 
 // TODO: don't create multiple jquery instances from chunks

+ 1 - 1
desktop/core/src/desktop/js/jquery/plugins/jquery.rowselector.js

@@ -16,7 +16,7 @@
 
 import $ from 'jquery';
 
-import huePubSub from '../../utils/huePubSub';
+import huePubSub from 'utils/huePubSub';
 
 /*
  * jHue row selector plugin

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ace/ko.aceEditor.js

@@ -21,7 +21,7 @@ import apiHelper from 'api/apiHelper';
 import AceLocationHandler from 'ko/bindings/ace/aceLocationHandler';
 import huePubSub from 'utils/huePubSub';
 import AceGutterHandler from 'ko/bindings/ace/aceGutterHandler';
-import { registerBinding } from '../bindingUtils';
+import { registerBinding } from 'ko/bindings/bindingUtils';
 
 // TODO: Depends on Ace
 

+ 1 - 1
desktop/core/src/desktop/js/ko/components/assist/assistStorageEntry.js

@@ -19,7 +19,7 @@ import * as ko from 'knockout';
 
 import apiHelper from 'api/apiHelper';
 import huePubSub from 'utils/huePubSub';
-import { GET_KNOWN_CONFIG_EVENT } from '../../../utils/hueConfig';
+import { GET_KNOWN_CONFIG_EVENT } from 'utils/hueConfig';
 
 const PAGE_SIZE = 100;
 

+ 2 - 2
desktop/core/src/desktop/js/ko/components/assist/assistStorageEntry.test.js

@@ -17,8 +17,8 @@
 import $ from 'jquery';
 
 import AssistStorageEntry from './assistStorageEntry';
-import huePubSub from '../../../utils/huePubSub';
-import { GET_KNOWN_CONFIG_EVENT } from '../../../utils/hueConfig';
+import huePubSub from 'utils/huePubSub';
+import { GET_KNOWN_CONFIG_EVENT } from 'utils/hueConfig';
 
 describe('assistStorageEntry.js', () => {
   it('it should handle domain in ADLS/ABFS', () => {

+ 33 - 0
desktop/core/src/desktop/js/ko/components/assist/events.js

@@ -0,0 +1,33 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+export const SHOW_LEFT_ASSIST_EVENT = 'left.assist.show';
+export const SHOW_RIGHT_ASSIST_EVENT = 'right.assist.show';
+
+export const ASSIST_IS_DB_PANEL_READY_EVENT = 'assist.is.db.panel.ready';
+export const ASSIST_DB_PANEL_IS_READY_EVENT = 'assist.db.panel.is.ready';
+export const ASSIST_GET_SOURCE_EVENT = 'assist.get.source';
+export const ASSIST_SET_SOURCE_EVENT = 'assist.set.source';
+export const ASSIST_GET_DATABASE_EVENT = 'assist.get.database';
+export const ASSIST_SET_DATABASE_EVENT = 'assist.set.database';
+export const ASSIST_DB_HIGHLIGHT_EVENT = 'assist.db.highlight';
+export const ASSIST_DOC_HIGHLIGHT_EVENT = 'assist.doc.highlight';
+
+export const ASSIST_SHOW_DOC_EVENT = 'assist.show.documents';
+export const ASSIST_SHOW_SQL_EVENT = 'assist.show.sql';
+export const ASSIST_SHOW_SOLR_EVENT = 'assist.show.solr';
+export const ASSIST_LANG_REF_SHOW_TOPIC_EVENT = 'assist.lang.ref.show.topic';
+export const ASSIST_LANG_REF_PANEL_SHOW_TOPIC_EVENT = 'assist.lang.ref.panel.show.topic';

+ 24 - 21
desktop/core/src/desktop/js/ko/components/assist/ko.assistDbPanel.js

@@ -24,6 +24,18 @@ import dataCatalog from 'catalog/dataCatalog';
 import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
 import { CONFIG_REFRESHED_EVENT, filterConnectors, GET_KNOWN_CONFIG_EVENT } from 'utils/hueConfig';
+import {
+  ASSIST_DB_HIGHLIGHT_EVENT,
+  ASSIST_DB_PANEL_IS_READY_EVENT,
+  ASSIST_GET_DATABASE_EVENT,
+  ASSIST_GET_SOURCE_EVENT,
+  ASSIST_IS_DB_PANEL_READY_EVENT,
+  ASSIST_SET_DATABASE_EVENT,
+  ASSIST_SET_SOURCE_EVENT,
+  ASSIST_SHOW_SOLR_EVENT,
+  ASSIST_SHOW_SQL_EVENT,
+  SHOW_LEFT_ASSIST_EVENT
+} from './events';
 
 const ASSIST_TABLE_TEMPLATES = `
   <script type="text/html" id="assist-no-database-entries">
@@ -588,12 +600,12 @@ class AssistDbPanel {
       return null;
     });
 
-    huePubSub.subscribe('assist.db.highlight', catalogEntry => {
-      huePubSub.publish('left.assist.show');
+    huePubSub.subscribe(ASSIST_DB_HIGHLIGHT_EVENT, catalogEntry => {
+      huePubSub.publish(SHOW_LEFT_ASSIST_EVENT);
       if (catalogEntry.getSourceType() === 'solr') {
-        huePubSub.publish('assist.show.solr');
+        huePubSub.publish(ASSIST_SHOW_SOLR_EVENT);
       } else {
-        huePubSub.publish('assist.show.sql');
+        huePubSub.publish(ASSIST_SHOW_SQL_EVENT);
       }
       huePubSub.publish('context.popover.hide');
       window.setTimeout(() => {
@@ -639,7 +651,7 @@ class AssistDbPanel {
         }
       });
     } else if (!this.isSolr && !this.isStreams) {
-      huePubSub.subscribe('assist.set.database', databaseDef => {
+      huePubSub.subscribe(ASSIST_SET_DATABASE_EVENT, databaseDef => {
         if (!databaseDef.source || !this.sourceIndex[databaseDef.source]) {
           return;
         }
@@ -690,24 +702,15 @@ class AssistDbPanel {
         return deferred;
       };
 
-      huePubSub.subscribe('assist.get.database', source => {
-        getSelectedDatabase(source).done(databaseDef => {
-          huePubSub.publish('assist.database.set', databaseDef);
-        });
-      });
-
-      huePubSub.subscribe('assist.get.database.callback', options => {
+      huePubSub.subscribe(ASSIST_GET_DATABASE_EVENT, options => {
         getSelectedDatabase(options.source).done(options.callback);
       });
 
-      huePubSub.subscribe('assist.get.source', () => {
-        huePubSub.publish(
-          'assist.source.set',
-          this.selectedSource() ? this.selectedSource().sourceType : undefined
-        );
+      huePubSub.subscribe(ASSIST_GET_SOURCE_EVENT, callback => {
+        callback(this.selectedSource() ? this.selectedSource().sourceType : undefined);
       });
 
-      huePubSub.subscribe('assist.set.source', source => {
+      huePubSub.subscribe(ASSIST_SET_SOURCE_EVENT, source => {
         if (this.sourceIndex[source]) {
           this.selectedSource(this.sourceIndex[source]);
         }
@@ -726,10 +729,10 @@ class AssistDbPanel {
     }
 
     this.init(options.navigationSettings).then(() => {
-      huePubSub.publish('assist.db.panel.ready');
+      huePubSub.publish(ASSIST_DB_PANEL_IS_READY_EVENT);
 
-      huePubSub.subscribe('assist.is.db.panel.ready', () => {
-        huePubSub.publish('assist.db.panel.ready');
+      huePubSub.subscribe(ASSIST_IS_DB_PANEL_READY_EVENT, () => {
+        huePubSub.publish(ASSIST_DB_PANEL_IS_READY_EVENT);
       });
     });
   }

+ 3 - 2
desktop/core/src/desktop/js/ko/components/assist/ko.assistDocumentsPanel.js

@@ -23,6 +23,7 @@ import HueFileEntry from 'doc/hueFileEntry';
 import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
 import { DOCUMENT_TYPES } from 'doc/docSupport';
+import { ASSIST_DOC_HIGHLIGHT_EVENT, ASSIST_SHOW_DOC_EVENT } from './events';
 
 export const REFRESH_DOC_ASSIST_EVENT = 'assist.document.refresh';
 
@@ -300,8 +301,8 @@ class AssistDocumentsPanel {
       self.reload();
     });
 
-    huePubSub.subscribe('assist.doc.highlight', details => {
-      huePubSub.publish('assist.show.documents');
+    huePubSub.subscribe(ASSIST_DOC_HIGHLIGHT_EVENT, details => {
+      huePubSub.publish(ASSIST_SHOW_DOC_EVENT);
       huePubSub.publish('context.popover.hide');
       const whenLoaded = $.Deferred().done(() => {
         self.activeEntry().highlightInside(details.docUuid);

+ 30 - 26
desktop/core/src/desktop/js/ko/components/assist/ko.assistLangRefPanel.js

@@ -26,6 +26,7 @@ import {
   ACTIVE_SNIPPET_CONNECTOR_CHANGED_EVENT,
   GET_ACTIVE_SNIPPET_CONNECTOR_EVENT
 } from 'apps/notebook2/events';
+import { ASSIST_LANG_REF_PANEL_SHOW_TOPIC_EVENT } from './events';
 
 // prettier-ignore
 const TEMPLATE = `
@@ -308,37 +309,40 @@ class AssistLangRefPanel {
 
     huePubSub.subscribe('scroll.test', scrollToSelectedTopic);
 
-    const showTopicSub = huePubSub.subscribe('assist.lang.ref.panel.show.topic', targetTopic => {
-      const topicStack = [];
-      const findTopic = topics => {
-        topics.some(topic => {
-          topicStack.push(topic);
-          if (topic.ref === targetTopic.ref) {
-            while (topicStack.length) {
-              topicStack.pop().open(true);
-            }
-            this.query('');
-            this.selectedTopic(topic);
-            window.setTimeout(() => {
-              scrollToAnchor(targetTopic.anchorId);
-              scrollToSelectedTopic();
-            }, 0);
-            return true;
-          } else if (topic.children.length) {
-            const inChild = findTopic(topic.children);
-            if (inChild) {
+    const showTopicSub = huePubSub.subscribe(
+      ASSIST_LANG_REF_PANEL_SHOW_TOPIC_EVENT,
+      targetTopic => {
+        const topicStack = [];
+        const findTopic = topics => {
+          topics.some(topic => {
+            topicStack.push(topic);
+            if (topic.ref === targetTopic.ref) {
+              while (topicStack.length) {
+                topicStack.pop().open(true);
+              }
+              this.query('');
+              this.selectedTopic(topic);
+              window.setTimeout(() => {
+                scrollToAnchor(targetTopic.anchorId);
+                scrollToSelectedTopic();
+              }, 0);
               return true;
+            } else if (topic.children.length) {
+              const inChild = findTopic(topic.children);
+              if (inChild) {
+                return true;
+              }
             }
-          }
-          topicStack.pop();
-        });
-      };
-      findTopic(this.topics());
-    });
+            topicStack.pop();
+          });
+        };
+        findTopic(this.topics());
+      }
+    );
 
     $(element).on('click.langref', event => {
       if (event.target.className === 'hue-doc-internal-link') {
-        huePubSub.publish('assist.lang.ref.panel.show.topic', {
+        huePubSub.publish(ASSIST_LANG_REF_PANEL_SHOW_TOPIC_EVENT, {
           ref: $(event.target).data('doc-ref'),
           anchorId: $(event.target).data('doc-anchor-id')
         });

+ 10 - 4
desktop/core/src/desktop/js/ko/components/assist/ko.assistPanel.js

@@ -23,6 +23,12 @@ import componentUtils from 'ko/components/componentUtils';
 import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
 import { GET_KNOWN_CONFIG_EVENT, CONFIG_REFRESHED_EVENT } from 'utils/hueConfig';
+import {
+  ASSIST_SHOW_DOC_EVENT,
+  ASSIST_SHOW_SOLR_EVENT,
+  ASSIST_SHOW_SQL_EVENT,
+  SHOW_LEFT_ASSIST_EVENT
+} from './events';
 
 const TEMPLATE = `
   <script type="text/html" id="assist-panel-inner-header">
@@ -112,7 +118,7 @@ class AssistPanel {
           });
           panels.push(sqlPanel);
 
-          huePubSub.subscribe('assist.show.sql', () => {
+          huePubSub.subscribe(ASSIST_SHOW_SQL_EVENT, () => {
             if (self.visiblePanel() !== sqlPanel) {
               self.visiblePanel(sqlPanel);
             }
@@ -164,7 +170,7 @@ class AssistPanel {
                 minHeight: 75
               });
               panels.push(solrPanel);
-              huePubSub.subscribe('assist.show.solr', () => {
+              huePubSub.subscribe(ASSIST_SHOW_SOLR_EVENT, () => {
                 if (self.visiblePanel() !== solrPanel) {
                   self.visiblePanel(solrPanel);
                 }
@@ -226,8 +232,8 @@ class AssistPanel {
 
           panels.push(documentsPanel);
 
-          huePubSub.subscribe('assist.show.documents', docType => {
-            huePubSub.publish('left.assist.show');
+          huePubSub.subscribe(ASSIST_SHOW_DOC_EVENT, docType => {
+            huePubSub.publish(SHOW_LEFT_ASSIST_EVENT);
             if (self.visiblePanel() !== documentsPanel) {
               self.visiblePanel(documentsPanel);
             }

+ 2 - 2
desktop/core/src/desktop/js/ko/components/assist/ko.assistStoragePanel.js

@@ -16,10 +16,10 @@
 
 import * as ko from 'knockout';
 
-import apiHelper from '../../../api/apiHelper';
+import apiHelper from 'api/apiHelper';
 import AssistStorageEntry from './assistStorageEntry';
 import componentUtils from 'ko/components/componentUtils';
-import huePubSub from '../../../utils/huePubSub';
+import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
 
 // prettier-ignore

+ 8 - 3
desktop/core/src/desktop/js/ko/components/assist/ko.rightAssistPanel.js

@@ -21,6 +21,11 @@ import componentUtils from 'ko/components/componentUtils';
 import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
 import { ACTIVE_SNIPPET_CONNECTOR_CHANGED_EVENT } from 'apps/notebook2/events';
+import {
+  ASSIST_LANG_REF_PANEL_SHOW_TOPIC_EVENT,
+  ASSIST_LANG_REF_SHOW_TOPIC_EVENT,
+  SHOW_RIGHT_ASSIST_EVENT
+} from './events';
 
 const EDITOR_ASSISTANT_TAB = 'editorAssistant';
 const DASHBOARD_ASSISTANT_TAB = 'dashboardAssistant';
@@ -123,12 +128,12 @@ class RightAssistPanel {
       }
     });
 
-    huePubSub.subscribe('assist.lang.ref.show.topic', targetTopic => {
-      huePubSub.publish('right.assist.show');
+    huePubSub.subscribe(ASSIST_LANG_REF_SHOW_TOPIC_EVENT, targetTopic => {
+      huePubSub.publish(SHOW_RIGHT_ASSIST_EVENT);
       if (this.langRefTabAvailable() && this.activeTab() !== LANG_REF_TAB) {
         this.activeTab(LANG_REF_TAB);
       }
-      huePubSub.publish('assist.lang.ref.panel.show.topic', targetTopic);
+      huePubSub.publish(ASSIST_LANG_REF_PANEL_SHOW_TOPIC_EVENT, targetTopic);
     });
 
     const updateTabs = () => {

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

@@ -20,6 +20,7 @@ import * as ko from 'knockout';
 import apiHelper from 'api/apiHelper';
 import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
+import { ASSIST_DB_HIGHLIGHT_EVENT } from 'ko/components/assist/events';
 
 class CollectionContextTabs {
   constructor(data) {
@@ -68,7 +69,7 @@ class CollectionContextTabs {
     self.activeTab = ko.observable('terms');
 
     const showInAssistPubSub = huePubSub.subscribe('context.popover.show.in.assist', () => {
-      huePubSub.publish('assist.db.highlight', self.catalogEntry);
+      huePubSub.publish(ASSIST_DB_HIGHLIGHT_EVENT, self.catalogEntry);
     });
     self.disposals.push(() => {
       showInAssistPubSub.remove();

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

@@ -19,6 +19,7 @@ import * as ko from 'knockout';
 
 import apiHelper from 'api/apiHelper';
 import huePubSub from 'utils/huePubSub';
+import { ASSIST_DB_HIGHLIGHT_EVENT } from 'ko/components/assist/events';
 
 class DataCatalogContext {
   constructor(options) {
@@ -176,7 +177,7 @@ class DataCatalogContext {
 
   showInAssist() {
     const self = this;
-    huePubSub.publish('assist.db.highlight', self.catalogEntry());
+    huePubSub.publish(ASSIST_DB_HIGHLIGHT_EVENT, self.catalogEntry());
     huePubSub.publish('global.search.close');
   }
 

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

@@ -18,6 +18,7 @@ import * as ko from 'knockout';
 
 import apiHelper from 'api/apiHelper';
 import huePubSub from 'utils/huePubSub';
+import { ASSIST_DOC_HIGHLIGHT_EVENT } from 'ko/components/assist/events';
 
 const TEMPLATE_NAME = 'context-document-details';
 
@@ -93,7 +94,7 @@ class DocumentContext {
     self.loadDocument();
 
     const showInAssistPubSub = huePubSub.subscribe('context.popover.show.in.assist', () => {
-      huePubSub.publish('assist.doc.highlight', {
+      huePubSub.publish(ASSIST_DOC_HIGHLIGHT_EVENT, {
         parentUuid: self.data.parentUuid,
         docUuid: self.data.uuid
       });

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

@@ -31,7 +31,7 @@ import LangRefContext from './langRefContext';
 import PartitionContext, { PARTITION_CONTEXT_TEMPLATE } from './partitionContext';
 import ResizeHelper from './resizeHelper';
 import StorageContext from './storageContext';
-import componentUtils from '../componentUtils';
+import componentUtils from 'ko/components/componentUtils';
 import { GET_KNOWN_CONFIG_EVENT } from 'utils/hueConfig';
 
 export const CONTEXT_POPOVER_CLASS = 'hue-popover';

+ 3 - 2
desktop/core/src/desktop/js/ko/components/contextPopover/langRefContext.js

@@ -18,6 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 import huePubSub from 'utils/huePubSub';
+import { ASSIST_LANG_REF_SHOW_TOPIC_EVENT } from 'ko/components/assist/events';
 
 class LangRefContext {
   constructor(options) {
@@ -36,7 +37,7 @@ class LangRefContext {
 
     $('.hue-popover').on('click.contextLangRef', event => {
       if (event.target.className === 'hue-doc-internal-link') {
-        huePubSub.publish('assist.lang.ref.show.topic', {
+        huePubSub.publish(ASSIST_LANG_REF_SHOW_TOPIC_EVENT, {
           ref: $(event.target).data('doc-ref'),
           anchorId: $(event.target).data('doc-anchor-id')
         });
@@ -50,7 +51,7 @@ class LangRefContext {
 
   openInRightAssist() {
     const self = this;
-    huePubSub.publish('assist.lang.ref.show.topic', { ref: self.topicId });
+    huePubSub.publish(ASSIST_LANG_REF_SHOW_TOPIC_EVENT, { ref: self.topicId });
     huePubSub.publish('context.popover.hide');
   }
 }

+ 2 - 2
desktop/core/src/desktop/js/ko/components/doc/ko.linkSharing.js

@@ -17,9 +17,9 @@
 import * as ko from 'knockout';
 
 import ApiHelper, { LINK_SHARING_PERMS } from '/api/apiHelper';
-import componentUtils from '../componentUtils';
+import componentUtils from 'ko/components/componentUtils';
 import I18n from 'utils/i18n';
-import DisposableComponent from '../DisposableComponent';
+import DisposableComponent from 'ko/components/DisposableComponent';
 import { DOCUMENT_UPDATED_EVENT } from 'doc/hueDocument';
 import huePubSub from 'utils/huePubSub';
 

+ 3 - 3
desktop/core/src/desktop/js/ko/components/doc/ko.shareDocModal.js

@@ -17,14 +17,14 @@
 import $ from 'jquery';
 import * as ko from 'knockout';
 
-import componentUtils from '../componentUtils';
+import componentUtils from 'ko/components/componentUtils';
 import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
 import HueFileEntry from 'doc/hueFileEntry';
-import DisposableComponent from '../DisposableComponent';
+import DisposableComponent from 'ko/components/DisposableComponent';
 
 import './ko.linkSharing';
-import { REFRESH_DOC_ASSIST_EVENT } from '../assist/ko.assistDocumentsPanel';
+import { REFRESH_DOC_ASSIST_EVENT } from 'ko/components/assist/ko.assistDocumentsPanel';
 
 export const SHOW_EVENT = 'doc.show.share.modal';
 export const SHOWN_EVENT = 'doc.share.modal.shown';

+ 2 - 1
desktop/core/src/desktop/js/ko/components/ko.contextSelector.js

@@ -23,6 +23,7 @@ import contextCatalog from 'catalog/contextCatalog';
 import dataCatalog from 'catalog/dataCatalog';
 import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
+import { ASSIST_SET_DATABASE_EVENT } from './assist/events';
 
 export const NAME = 'hue-context-selector';
 
@@ -472,7 +473,7 @@ HueContextSelector.prototype.reloadDatabases = function() {
                   self.loadingDatabases(false);
 
                   if (updateAssist) {
-                    huePubSub.publish('assist.set.database', {
+                    huePubSub.publish(ASSIST_SET_DATABASE_EVENT, {
                       source: ko.unwrap(self.sourceType),
                       namespace: self[TYPES_INDEX.namespace.name](),
                       name: self.database()

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

@@ -21,8 +21,8 @@ import componentUtils from './componentUtils';
 import huePubSub from 'utils/huePubSub';
 import sqlUtils from 'sql/sqlUtils';
 import DisposableComponent from './DisposableComponent';
-import { DRAGGABLE_TEXT_META_EVENT } from '../bindings/ko.draggableText';
-import { INSERT_AT_CURSOR_EVENT } from '../bindings/ace/ko.aceEditor';
+import { DRAGGABLE_TEXT_META_EVENT } from 'ko/bindings/ko.draggableText';
+import { INSERT_AT_CURSOR_EVENT } from 'ko/bindings/ace/ko.aceEditor';
 import { defer, sleep } from 'utils/hueUtils';
 
 export const NAME = 'hue-editor-droppable-menu';

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

@@ -22,6 +22,7 @@ import dataCatalog from 'catalog/dataCatalog';
 import componentUtils from './componentUtils';
 import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
+import { ASSIST_SHOW_SQL_EVENT } from './assist/events';
 
 export const NAME = 'hue-global-search';
 
@@ -401,7 +402,7 @@ class GlobalSearch {
     if (entry.data && entry.data.link) {
       huePubSub.publish('open.link', entry.data.link);
     } else if (!/:\s*$/.test(entry.value)) {
-      huePubSub.publish('assist.show.sql');
+      huePubSub.publish(ASSIST_SHOW_SQL_EVENT);
       huePubSub.publish('assist.db.search', entry.value);
     }
   }

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

@@ -20,7 +20,7 @@ import * as ko from 'knockout';
 import componentUtils from './componentUtils';
 import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
-import HueFileEntry from '../../doc/hueFileEntry';
+import HueFileEntry from 'doc/hueFileEntry';
 
 export const HIDE_EVENT = 'hide.import.documents.modal';
 export const SHOW_EVENT = 'show.import.documents.modal';

+ 1 - 1
desktop/core/src/desktop/js/ko/components/ko.sessionAuthModal.test.js

@@ -19,7 +19,7 @@ import huePubSub from 'utils/huePubSub';
 
 import 'ext/bootstrap.2.3.2.min';
 import sessionManager from 'apps/notebook2/execution/sessionManager';
-import { simulateInput } from '../../jest/koTestUtils';
+import { simulateInput } from 'jest/koTestUtils';
 
 describe('ko.sessionAuthModal.js', () => {
   it('should render component', async () => {

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

@@ -21,6 +21,7 @@ import apiHelper from 'api/apiHelper';
 import hueAnalytics from 'utils/hueAnalytics';
 import huePubSub from 'utils/huePubSub';
 import { ACTIVE_SNIPPET_CONNECTOR_CHANGED_EVENT } from 'apps/notebook2/events';
+import { SHOW_LEFT_ASSIST_EVENT, SHOW_RIGHT_ASSIST_EVENT } from 'ko/components/assist/events';
 
 class SidePanelViewModel {
   constructor() {
@@ -146,13 +147,13 @@ class SidePanelViewModel {
       }, 0);
     });
 
-    huePubSub.subscribe('right.assist.show', () => {
+    huePubSub.subscribe(SHOW_RIGHT_ASSIST_EVENT, () => {
       if (!self.rightAssistVisible()) {
         self.rightAssistVisible(true);
       }
     });
 
-    huePubSub.subscribe('left.assist.show', () => {
+    huePubSub.subscribe(SHOW_LEFT_ASSIST_EVENT, () => {
       if (!self.leftAssistVisible()) {
         self.leftAssistVisible(true);
       }

+ 1 - 1
desktop/core/src/desktop/js/sql/sqlAutocompleter.test.ignore.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 import dataCatalog from 'catalog/dataCatalog';
-import SqlAutocompleter from '../sqlAutocompleter';
+import SqlAutocompleter from 'sql/sqlAutocompleter';
 
 // TODO: Ignore until ace is in webpack