소스 검색

HUE-8758 [connector] Prevent js exception when the editor is opened for a non-existing connector

Johan Ahlen 5 년 전
부모
커밋
31322751dc

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

@@ -24,7 +24,6 @@ import componentUtils from 'ko/components/componentUtils';
 import dataCatalog from 'catalog/dataCatalog';
 import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
-import { ACTIVE_SNIPPET_CONNECTOR_CHANGED_EVENT } from 'apps/notebook2/events';
 
 const TEMPLATE =
   ASSIST_TABLE_TEMPLATES +

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

@@ -186,7 +186,7 @@ class RightAssistPanel {
     const updateContentsForConnector = connector => {
       this.connector(connector);
       this.schedulesTabAvailable(false);
-      if (connector.type !== 'dashboard') {
+      if (connector && connector.type !== 'dashboard') {
         if (window.ENABLE_QUERY_SCHEDULING) {
           huePubSub.subscribeOnce('set.current.app.view.model', viewModel => {
             // Async

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

@@ -73,7 +73,7 @@ class SidePanelViewModel {
     huePubSub.publish('get.current.app.name', onAppChange);
 
     huePubSub.subscribe(ACTIVE_SNIPPET_CONNECTOR_CHANGED_EVENT, connector => {
-      self.rightAssistAvailable(connector.is_sql || connector.dialect === 'pig');
+      self.rightAssistAvailable(connector && (connector.is_sql || connector.dialect === 'pig'));
     });
 
     self.activeAppViewModel = ko.observable();