Ver Fonte

HUE-9389 [ui] Fix missing connector id for the indexes and streams assist panels

Johan Ahlen há 5 anos atrás
pai
commit
ed020d94d1

+ 4 - 0
desktop/core/src/desktop/js/ko/components/assist/ko.assistDashboardPanel.js

@@ -22,6 +22,7 @@ import componentUtils from 'ko/components/componentUtils';
 import dataCatalog from 'catalog/dataCatalog';
 import huePubSub from 'utils/huePubSub';
 import { TEMPLATE, AssistantUtils } from 'ko/components/assist/ko.assistEditorContextPanel';
+import { findDashboardConnector } from 'utils/hueConfig';
 
 class AssistDashboardPanel {
   constructor() {
@@ -66,12 +67,15 @@ class AssistDashboardPanel {
 
       this.sourceType = ko.observable(collection.engine());
 
+      const connector = findDashboardConnector(connector => connector.id === collection.engine());
+
       const assistDbSource = new AssistDbSource({
         i18n: i18n,
         initialNamespace: collection.activeNamespace,
         initialCompute: collection.activeCompute,
         type: collection.engine(),
         name: collection.engine(),
+        connector: connector,
         nonSqlType: true,
         navigationSettings: navigationSettings
       });

+ 15 - 7
desktop/core/src/desktop/js/ko/components/assist/ko.assistDbPanel.js

@@ -23,7 +23,12 @@ import componentUtils from 'ko/components/componentUtils';
 import dataCatalog from 'catalog/dataCatalog';
 import huePubSub from 'utils/huePubSub';
 import I18n from 'utils/i18n';
-import { CONFIG_REFRESHED_EVENT, filterEditorConnectors } from 'utils/hueConfig';
+import {
+  CONFIG_REFRESHED_EVENT,
+  filterEditorConnectors,
+  findDashboardConnector,
+  findEditorConnector
+} from 'utils/hueConfig';
 import {
   ASSIST_DB_HIGHLIGHT_EVENT,
   ASSIST_DB_PANEL_IS_READY_EVENT,
@@ -789,16 +794,17 @@ class AssistDbPanel {
     }
   }
 
-  setSingleSource(type, navigationSettings, nonSqlType) {
+  setSingleSource(connector, navigationSettings, nonSqlType) {
     this.sourceIndex = {};
     const source = new AssistDbSource({
       i18n: this.i18n,
-      type: type,
-      name: type,
+      type: connector.id,
+      name: connector.displayName,
+      connector: connector,
       nonSqlType: nonSqlType,
       navigationSettings: navigationSettings
     });
-    this.sourceIndex[type] = source;
+    this.sourceIndex[connector.id] = source;
     this.sources([source]);
     this.selectedSource(source);
 
@@ -815,12 +821,14 @@ class AssistDbPanel {
 
   init(navigationSettings) {
     if (this.isSolr) {
-      this.setSingleSource('solr', navigationSettings, true);
+      const connector = findDashboardConnector(connector => connector.id === 'solr');
+      this.setSingleSource(connector, navigationSettings, true);
       return;
     }
 
     if (this.isStreams) {
-      this.setSingleSource('kafka', navigationSettings, true);
+      const connector = findEditorConnector(connector => connector.dialect === 'kafka sql');
+      this.setSingleSource(connector, navigationSettings, true);
       return;
     }
 

+ 5 - 1
desktop/core/src/desktop/js/utils/hueConfig.js

@@ -69,7 +69,8 @@ export const getLastKnownConfig = () => lastKnownConfig;
 
 const CONNECTOR_TYPES = {
   editor: 'editor',
-  browser: 'browser'
+  browser: 'browser',
+  dashboard: 'dashboard'
 };
 
 const findConnector = (connectorTest, type) => {
@@ -90,6 +91,9 @@ const filterConnectors = (connectorTest, type) => {
 export const findBrowserConnector = connectorTest =>
   findConnector(connectorTest, CONNECTOR_TYPES.browser);
 
+export const findDashboardConnector = connectorTest =>
+  findConnector(connectorTest, CONNECTOR_TYPES.dashboard);
+
 export const findEditorConnector = connectorTest =>
   findConnector(connectorTest, CONNECTOR_TYPES.editor);
 

+ 3 - 0
desktop/core/src/desktop/models.py

@@ -1846,6 +1846,7 @@ class ClusterConfig(object):
         interpreters.append({
           'name': interpreter['name'],
           'type': interpreter['type'],
+          'id': interpreter['type'],
           'displayName': interpreter['name'],
           'buttonName': _('Query'),
           'tooltip': _('%s Query') % interpreter['type'].title(),
@@ -1864,6 +1865,7 @@ class ClusterConfig(object):
       if HAS_REPORT_ENABLED.get():
         _interpreters.append({
           'type': 'report',
+          'id': 'report',
           'displayName': 'Report',
           'buttonName': 'Report',
           'page': '/dashboard/new_search?engine=report',
@@ -1873,6 +1875,7 @@ class ClusterConfig(object):
 
       _interpreters.extend([{
           'type': interpreter['type'],
+          'id': interpreter['type'],
           'displayName': interpreter['type'].title(),
           'buttonName': interpreter['type'].title(),
           'page': '/dashboard/new_search?engine=%(type)s' % interpreter,