Răsfoiți Sursa

HUE-9187 [editor] Drop the mako json usage of "languages" in editor v2

This takes care of mismatch issues from the get_config API
Johan Ahlen 5 ani în urmă
părinte
comite
3e3e02b6a1

+ 0 - 2
apps/beeswax/src/beeswax/templates/execute.mako

@@ -51,8 +51,6 @@ ${ layout.menubar(section='query') }
                 user: HIVE_AUTOCOMPLETE_USER,
                 onlySql: true,
                 sql: {
-                  sourceTypes: editorViewModel.sqlSourceTypes,
-                  activeSourceType: snippetType,
                   navigationSettings: {
                     openItem: false,
                     showPreview: true,

+ 0 - 24
desktop/core/src/desktop/js/apps/notebook2/editorViewModel.js

@@ -118,30 +118,6 @@ class EditorViewModel {
 
     this.ChartTransformers = ChartTransformers;
 
-    // TODO: Drop the SQL source types from the notebook. They're now set in AssistDbPanel.
-    this.sqlSourceTypes = [];
-
-    if (options.languages && this.snippetViewSettings) {
-      options.languages.forEach(language => {
-        const viewSettings = this.snippetViewSettings[language.type];
-        if (viewSettings && viewSettings.sqlDialect) {
-          this.sqlSourceTypes.push({
-            type: language.type,
-            name: language.name
-          });
-        }
-      });
-    }
-
-    const sqlSourceTypes = this.sqlSourceTypes.filter(
-      language => language.type === this.editorType()
-    );
-    if (sqlSourceTypes.length > 0) {
-      this.activeSqlSourceType = sqlSourceTypes[0].type;
-    } else {
-      this.activeSqlSourceType = null;
-    }
-
     this.isEditing = ko.observable(false);
     this.isEditing.subscribe(() => {
       $(document).trigger('editingToggled');

+ 8 - 11
desktop/core/src/desktop/js/ko/components/assist/ko.assistDbPanel.js

@@ -566,10 +566,6 @@ class AssistDbPanel {
   /**
    * @param {Object} options
    * @param {Object} options.i18n
-   * @param {Object[]} options.sourceTypes - All the available SQL source types
-   * @param {string} options.sourceTypes[].name - Example: Hive SQL
-   * @param {string} options.sourceTypes[].type - Example: hive
-   * @param {string} [options.activeSourceType] - Example: hive
    * @param {Object} options.navigationSettings - enable/disable the links
    * @param {boolean} options.navigationSettings.openItem
    * @param {boolean} options.navigationSettings.showStats
@@ -753,7 +749,7 @@ class AssistDbPanel {
       });
     }
 
-    self.init(options.navigationSettings, options.activeSourceType).then(() => {
+    self.init(options.navigationSettings).then(() => {
       huePubSub.publish('assist.db.panel.ready');
 
       huePubSub.subscribe('assist.is.db.panel.ready', () => {
@@ -847,7 +843,7 @@ class AssistDbPanel {
     });
   }
 
-  async init(navigationSettings, activeSourceType) {
+  async init(navigationSettings) {
     return new Promise(resolve => {
       if (self.isSolr) {
         this.setSingleSource('solr', navigationSettings, true);
@@ -891,11 +887,12 @@ class AssistDbPanel {
         });
 
         if (sources.indexOf(this.selectedSource()) === -1) {
-          const storageSourceType =
-            activeSourceType || apiHelper.getFromTotalStorage('assist', 'lastSelectedSource');
-          this.selectedSource(
-            this.sourceIndex[storageSourceType] || (sources.length ? sources[0] : null)
-          );
+          if (sources.length) {
+            const storageSourceType = apiHelper.getFromTotalStorage('assist', 'lastSelectedSource');
+            this.selectedSource(this.sourceIndex[storageSourceType] || sources[0]);
+          } else {
+            this.selectedSource(undefined);
+          }
         }
         this.sources(sources);
       };

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

@@ -64,10 +64,6 @@ class AssistPanel {
    * @param {boolean} params.onlySql - For the old query editors
    * @param {string[]} params.visibleAssistPanels - Panels that will initially be shown regardless of total storage
    * @param {Object} params.sql
-   * @param {Object[]} params.sql.sourceTypes - All the available SQL source types
-   * @param {string} params.sql.sourceTypes[].name - Example: Hive SQL
-   * @param {string} params.sql.sourceTypes[].type - Example: hive
-   * @param {string} [params.sql.activeSourceType] - Example: hive
    * @param {Object} params.sql.navigationSettings - enable/disable the links
    * @param {boolean} params.sql.navigationSettings.openItem - Example: true
    * @param {boolean} params.sql.navigationSettings.showStats - Example: true

+ 0 - 2
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -411,8 +411,6 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
         params: {
           user: user,
           sql: {
-            sourceTypes: sqlSourceTypes,
-            activeSourceType: activeSqlSourceType,
             navigationSettings: {
               openDatabase: false,
               openItem: false,

+ 0 - 2
desktop/libs/notebook/src/notebook/templates/editor_components2.mako

@@ -407,8 +407,6 @@
         params: {
           user: user,
           sql: {
-            sourceTypes: sqlSourceTypes,
-            activeSourceType: activeSqlSourceType,
             navigationSettings: {
               openDatabase: false,
               openItem: false,