Эх сурвалжийг харах

HUE-8687 [frontend] Modularize the context catalog

Johan Ahlen 6 жил өмнө
parent
commit
8bf78c96c6
21 өөрчлөгдсөн 803 нэмэгдсэн , 412 устгасан
  1. 1 1
      apps/metastore/src/metastore/static/metastore/js/metastore.model.js
  2. 2 2
      apps/oozie/src/oozie/static/oozie/js/workflow-editor.ko.js
  3. 1 1
      apps/pig/src/pig/templates/app.mako
  4. 5 7
      desktop/core/src/desktop/js/catalog/catalogUtils.js
  5. 348 0
      desktop/core/src/desktop/js/catalog/contextCatalog.js
  6. 2 1
      desktop/core/src/desktop/js/catalog/dataCatalog.js
  7. 2 0
      desktop/core/src/desktop/js/hue.js
  8. 3 3
      desktop/core/src/desktop/static/desktop/js/assist/assistDbSource.js
  9. 0 354
      desktop/core/src/desktop/static/desktop/js/contextCatalog.js
  10. 0 0
      desktop/core/src/desktop/static/desktop/js/hue-bundle-4db50f164ec4ddffd941.js.map
  11. 431 34
      desktop/core/src/desktop/static/desktop/js/hue-bundle-fbeb7ee72f1233caa7d8.js
  12. 0 0
      desktop/core/src/desktop/static/desktop/js/hue-bundle-fbeb7ee72f1233caa7d8.js.map
  13. 1 1
      desktop/core/src/desktop/static/desktop/js/jquery.hiveautocomplete.js
  14. 0 1
      desktop/core/src/desktop/templates/hue.mako
  15. 1 1
      desktop/core/src/desktop/templates/ko_components/ko_context_popover.mako
  16. 1 1
      desktop/core/src/desktop/templates/ko_components/ko_context_selector.mako
  17. 1 1
      desktop/libs/dashboard/src/dashboard/static/dashboard/js/search.ko.js
  18. 1 1
      desktop/libs/indexer/src/indexer/templates/importer.mako
  19. 1 1
      desktop/libs/indexer/src/indexer/templates/indexes.mako
  20. 1 1
      desktop/libs/indexer/src/indexer/templates/topics.mako
  21. 1 1
      webpack-stats.json

+ 1 - 1
apps/metastore/src/metastore/static/metastore/js/metastore.model.js

@@ -158,7 +158,7 @@ var MetastoreSource = (function () {
   MetastoreSource.prototype.loadNamespaces = function () {
     var self = this;
     self.loading(true);
-    ContextCatalog.getNamespaces({ sourceType: self.type }).done(function (context) {
+    contextCatalog.getNamespaces({ sourceType: self.type }).done(function (context) {
       var namespacesWithComputes = context.namespaces.filter(function (namespace) { return namespace.computes.length });
       self.namespaces($.map(namespacesWithComputes, function (namespace) {
         return new MetastoreNamespace({

+ 2 - 2
apps/oozie/src/oozie/static/oozie/js/workflow-editor.ko.js

@@ -531,8 +531,8 @@ var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_
   self.availableComputes = ko.observableArray();
   self.compute = ko.observable();
 
-  ContextCatalog.getNamespaces({ sourceType: 'oozie' }).done(function (context) { self.availableNamespaces(context.namespaces) });
-  ContextCatalog.getComputes({ sourceType: 'oozie' }).done(self.availableComputes);
+  contextCatalog.getNamespaces({ sourceType: 'oozie' }).done(function (context) { self.availableNamespaces(context.namespaces) });
+  contextCatalog.getComputes({ sourceType: 'oozie' }).done(self.availableComputes);
 
 
   self.previewColumns = ko.observable("");

+ 1 - 1
apps/pig/src/pig/templates/app.mako

@@ -1018,7 +1018,7 @@ ${ commonshare() | n,unicode }
 
     % if autocomplete_base_url != '':
       var apiHelper = window.apiHelper;
-      ContextCatalog.getNamespaces({ sourceType: 'hive' }).done(function (context) {
+      contextCatalog.getNamespaces({ sourceType: 'hive' }).done(function (context) {
         // TODO: Namespace and compute selection
         dataCatalog.getChildren({ namespace: context.namespaces[0], compute: context.namespaces[0].computes[0], sourceType: 'hive', path: ['default'], silenceErrors: true }).done(function (childEntries) {
           availableTables = $.map(childEntries, function (entry) { return entry.name }).join(' ');

+ 5 - 7
desktop/core/src/desktop/js/catalog/catalogUtils.js

@@ -26,19 +26,17 @@ import CancellablePromise from '../api/cancellablePromise'
  * @param {Object} [apiOptions]
  * @param {boolean} [apiOptions.silenceErrors]
  */
-const fetchAndSave = function (apiHelperFunction, attributeName, entry, apiOptions) {
-  return apiHelper[apiHelperFunction]({
+const fetchAndSave = (apiHelperFunction, attributeName, entry, apiOptions) => apiHelper[apiHelperFunction]({
     sourceType: entry.dataCatalog.sourceType,
     compute: entry.compute,
     path: entry.path, // Set for DataCatalogEntry
     paths: entry.paths, // Set for MultiTableEntry
     silenceErrors: apiOptions && apiOptions.silenceErrors,
     isView: entry.isView && entry.isView() // MultiTable entries don't have this property
-  }).done(function (data) {
+  }).done(data => {
     entry[attributeName] = data;
     entry.saveLater();
-  })
-};
+  });
 
 /**
  * Helper function that adds sets the silence errors option to true if not specified
@@ -46,7 +44,7 @@ const fetchAndSave = function (apiHelperFunction, attributeName, entry, apiOptio
  * @param {Object} [options]
  * @return {Object}
  */
-const setSilencedErrors = function (options) {
+const setSilencedErrors = options => {
   if (!options) {
     options = {};
   }
@@ -65,7 +63,7 @@ const setSilencedErrors = function (options) {
  *
  * @return {CancellablePromise}
  */
-const applyCancellable = function (promise, options) {
+const applyCancellable = (promise, options) => {
   if (promise && promise.preventCancel && (!options || !options.cancellable)) {
     promise.preventCancel();
   }

+ 348 - 0
desktop/core/src/desktop/js/catalog/contextCatalog.js

@@ -0,0 +1,348 @@
+// 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.
+
+import $ from 'jquery'
+import localforage from 'localforage'
+
+import apiHelper from '../api/apiHelper'
+import huePubSub from '../utils/huePubSub'
+
+/**
+ * @typedef {Object} ContextCompute
+ * @property {string} id
+ * @property {string} name
+ */
+
+/**
+ * @typedef {Object} ContextNamespace
+ * @property {string} id
+ * @property {string} name
+ * @property {ContextCompute} computes
+ */
+
+const STORAGE_POSTFIX = LOGGED_USERNAME;
+const CONTEXT_CATALOG_VERSION = 4;
+const NAMESPACES_CONTEXT_TYPE = 'namespaces';
+const DISABLE_CACHE = true;
+
+class ContextCatalog {
+
+  constructor() {
+    let self = this;
+    self.namespaces = {};
+    self.namespacePromises = {};
+
+    self.computes = {};
+    self.computePromises = {};
+
+    self.clusters = {};
+    self.clusterPromises = {};
+
+    let addPubSubs = () => {
+      if (typeof huePubSub !== 'undefined') {
+        huePubSub.subscribe('context.catalog.refresh', () => {
+          let namespacesToRefresh = Object.keys(self.namespaces);
+          self.namespaces = {};
+          self.namespacePromises = {};
+
+          self.computes = {};
+          self.computePromises = {};
+
+          self.clusters = {};
+          self.clusterPromises = {};
+          huePubSub.publish('context.catalog.refreshed');
+          namespacesToRefresh.forEach(sourceType => {
+            huePubSub.publish('context.catalog.namespaces.refreshed', sourceType);
+          })
+        })
+      } else {
+        window.setTimeout(addPubSubs, 100);
+      }
+    };
+
+    addPubSubs();
+  }
+
+  getStore() {
+    if (!self.store) {
+      self.store = localforage.createInstance({
+        name: 'HueContextCatalog_' + STORAGE_POSTFIX
+      });
+    }
+    return self.store;
+  };
+
+  saveLater(contextType, sourceType, entry) {
+    let self = this;
+    window.setTimeout(() => {
+      self.getStore().setItem(sourceType + '_' + contextType, { version: CONTEXT_CATALOG_VERSION, entry: entry });
+    }, 1000);
+  };
+
+  getSaved(contextType, sourceType) {
+    let self = this;
+    let deferred = $.Deferred();
+
+    if (DISABLE_CACHE) {
+      return deferred.reject().promise();
+    }
+
+    self.getStore().getItem(sourceType + '_' + contextType).then(saved => {
+      if (saved && saved.version === CONTEXT_CATALOG_VERSION) {
+        deferred.resolve(saved.entry);
+      } else {
+        deferred.reject();
+      }
+    }).catch(error => {
+      console.warn(error);
+      deferred.reject();
+    });
+
+    return deferred.promise();
+  };
+
+  /**
+   * @param {Object} options
+   * @param {string} options.sourceType
+   * @param {boolean} [options.clearCache] - Default False
+   * @param {boolean} [options.silenceErrors] - Default False
+   * @return {Promise}
+   */
+  getNamespaces(options) {
+    let self = this;
+
+    let notifyForRefresh = self.namespacePromises[options.sourceType] && options.clearCache;
+    if (options.clearCache) {
+      self.namespacePromises[options.sourceType] = undefined;
+      self.namespaces[options.sourceType] = undefined;
+    }
+
+    if (self.namespacePromises[options.sourceType]) {
+      return self.namespacePromises[options.sourceType];
+    }
+
+    if (self.namespaces[options.sourceType]) {
+      self.namespacePromises[options.sourceType] = $.Deferred().resolve(self.namespaces[options.sourceType]).promise();
+      return self.namespacePromises[options.sourceType];
+    }
+
+    let deferred = $.Deferred();
+
+    self.namespacePromises[options.sourceType] = deferred.promise();
+
+    let startingNamespaces = {};
+    let pollTimeout = -1;
+
+    let pollForStarted = () => {
+      window.clearTimeout(pollTimeout);
+      window.setTimeout(() => {
+        if (Object.keys(startingNamespaces).length) {
+          apiHelper.fetchContextNamespaces(options).done(namespaces => {
+            if (namespaces[options.sourceType]) {
+              let namespaces = namespaces[options.sourceType];
+              if (namespaces) {
+                let statusChanged = false;
+                namespaces.forEach(namespace => {
+                  if (startingNamespaces[namespace.id] && namespace.status !== 'STARTING') {
+                    startingNamespaces[namespace.id].status = namespace.status;
+                    delete startingNamespaces[namespace.id];
+                    statusChanged = true;
+                  }
+                });
+                if (statusChanged) {
+                  huePubSub.publish('context.catalog.namespaces.refreshed', options.sourceType);
+                }
+                if (Object.keys(startingNamespaces).length) {
+                  pollForStarted();
+                }
+              }
+            }
+          });
+        }
+      }, 2000);
+    };
+
+    deferred.done(context => {
+      context.namespaces.forEach(namespace => {
+        if (namespace.status === 'STARTING') {
+          startingNamespaces[namespace.id] = namespace;
+        }
+      });
+      if (Object.keys(startingNamespaces).length) {
+        pollForStarted();
+      }
+    });
+
+    let fetchNamespaces = () => {
+      apiHelper.fetchContextNamespaces(options).done(namespaces => {
+        if (namespaces[options.sourceType]) {
+          const dynamic = namespaces.dynamicClusters;
+          namespaces = namespaces[options.sourceType];
+          if (namespaces) {
+            namespaces.forEach(namespace => {
+              namespace.computes.forEach(compute => {
+                if (!compute.id && compute.crn) {
+                  compute.id = compute.crn;
+                }
+                if (!compute.name && compute.clusterName) {
+                  compute.name = compute.clusterName;
+                }
+              })
+            });
+            self.namespaces[options.sourceType] = {
+              namespaces: namespaces.filter(namespace => namespace.name),
+              dynamic: dynamic,
+              hueTimestamp: Date.now()
+            };
+            deferred.resolve(self.namespaces[options.sourceType]);
+            if (notifyForRefresh) {
+              huePubSub.publish('context.catalog.namespaces.refreshed', options.sourceType);
+            }
+
+            if (self.namespaces[options.sourceType].namespaces.length) {
+              self.saveLater(NAMESPACES_CONTEXT_TYPE, options.sourceType, self.namespaces[options.sourceType]);
+            } else {
+              self.getStore().removeItem(options.sourceType + '_' + NAMESPACES_CONTEXT_TYPE);
+            }
+          } else {
+            deferred.reject();
+          }
+        } else {
+          deferred.reject();
+        }
+      });
+    };
+
+    if (!options.clearCache) {
+      self.getSaved(NAMESPACES_CONTEXT_TYPE, options.sourceType).done(namespaces => {
+        self.namespaces[options.sourceType] = namespaces;
+        deferred.resolve(self.namespaces[options.sourceType]);
+      }).fail(fetchNamespaces);
+    } else {
+      fetchNamespaces();
+    }
+
+    return self.namespacePromises[options.sourceType];
+  };
+
+  /**
+   * @param {Object} options
+   * @param {string} options.sourceType
+   * @param {boolean} [options.silenceErrors] - Default False
+   * @param {boolean} [options.clearCache] - Default False
+   * @return {Promise}
+   */
+  getComputes(options) {
+    let self = this;
+
+    if (options.clearCache) {
+      self.computePromises[options.sourceType] = undefined;
+      self.computes[options.sourceType] = undefined;
+    }
+
+    if (self.computePromises[options.sourceType]) {
+      return self.computePromises[options.sourceType];
+    }
+
+    if (self.computes[options.sourceType]) {
+      self.computePromises[options.sourceType] = $.Deferred().resolve(self.computes[options.sourceType]).promise();
+      return self.computePromises[options.sourceType];
+    }
+
+    let deferred = $.Deferred();
+    self.computePromises[options.sourceType] = deferred.promise();
+
+    apiHelper.fetchContextComputes(options).done(computes => {
+      if (computes[options.sourceType]) {
+        computes = computes[options.sourceType];
+        if (computes) {
+          self.computes[options.sourceType] = computes;
+          deferred.resolve(self.computes[options.sourceType])
+          // TODO: save
+        } else {
+          deferred.reject();
+        }
+      } else {
+        deferred.reject();
+      }
+    });
+
+    return self.computePromises[options.sourceType];
+  };
+
+  /**
+   * @param {Object} options
+   * @param {string} options.sourceType
+   * @param {boolean} [options.silenceErrors] - Default False
+   * @return {Promise}
+   */
+  getClusters(options) {
+    let self = this;
+
+    if (self.clusterPromises[options.sourceType]) {
+      return self.clusterPromises[options.sourceType];
+    }
+
+    if (self.clusters[options.sourceType]) {
+      self.clusterPromises[options.sourceType] = $.Deferred().resolve(self.clusters[options.sourceType]).promise();
+      return self.clusterPromises[options.sourceType];
+    }
+
+    let deferred = $.Deferred();
+    self.clusterPromises[options.sourceType] = deferred.promise();
+
+    apiHelper.fetchContextClusters(options).done(clusters => {
+      if (clusters && clusters[options.sourceType]) {
+        self.clusters[options.sourceType] = clusters[options.sourceType];
+        deferred.resolve(self.clusters[options.sourceType])
+      } else {
+        deferred.reject();
+      }
+    });
+
+    return self.clusterPromises[options.sourceType];
+  };
+}
+
+let contextCatalog = new ContextCatalog();
+
+export default {
+
+  /**
+   * @param {Object} options
+   * @param {string} options.sourceType
+   * @param {boolean} [options.clearCache] - Default False
+   * @param {boolean} [options.silenceErrors] - Default False
+   * @return {Promise}
+   */
+  getNamespaces: options => contextCatalog.getNamespaces(options),
+
+  /**
+   * @param {Object} options
+   * @param {string} options.sourceType
+   * @param {boolean} [options.silenceErrors] - Default False
+   * @return {Promise}
+   */
+  getComputes: options => contextCatalog.getComputes(options),
+
+  /**
+   * @param {Object} options
+   * @param {string} options.sourceType // TODO: rename?
+   * @param {boolean} [options.silenceErrors] - Default False
+   * @return {Promise}
+   */
+  getClusters: options => contextCatalog.getClusters(options)
+}

+ 2 - 1
desktop/core/src/desktop/js/catalog/dataCatalog.js

@@ -17,6 +17,7 @@
 import $ from 'jquery'
 import localforage from 'localforage'
 
+import apiHelper from '../api/apiHelper'
 import CancellablePromise from '../api/cancellablePromise'
 import catalogUtils from './catalogUtils'
 import DataCatalogEntry from './dataCatalogEntry'
@@ -274,7 +275,7 @@ class DataCatalog {
     $.when.apply($, existingPromises).always(function () {
       let loadDeferred = $.Deferred();
       if (pathsToLoad.length) {
-        cancellablePromises.push(window.apiHelper.fetchNavOptPopularity({
+        cancellablePromises.push(apiHelper.fetchNavOptPopularity({
           silenceErrors: options.silenceErrors,
           paths: pathsToLoad
         }).done(function (data) {

+ 2 - 0
desktop/core/src/desktop/js/hue.js

@@ -32,6 +32,7 @@ import 'knockout.validation'
 
 import apiHelper from 'api/apiHelper';
 import CancellablePromise from 'api/cancellablePromise'
+import contextCatalog from 'catalog/contextCatalog'
 import dataCatalog from 'catalog/dataCatalog'
 import hueAnalytics from 'utils/hueAnalytics'
 import hueDebug from 'utils/hueDebug'
@@ -43,6 +44,7 @@ import hueUtils from 'utils/hueUtils'
 window._ = _;
 window.apiHelper = apiHelper;
 window.CancellablePromise = CancellablePromise;
+window.contextCatalog = contextCatalog;
 window.dataCatalog = dataCatalog;
 window.filesize = filesize;
 window.hueUtils = hueUtils;

+ 3 - 3
desktop/core/src/desktop/static/desktop/js/assist/assistDbSource.js

@@ -96,7 +96,7 @@ var AssistDbSource = (function () {
       }
 
       self.loading(true);
-      ContextCatalog.getNamespaces({ sourceType: self.sourceType }).done(function (context) {
+      contextCatalog.getNamespaces({ sourceType: self.sourceType }).done(function (context) {
         var newNamespaces = [];
         var existingNamespaceIndex = {};
         self.namespaces().forEach(function (assistNamespace) {
@@ -135,10 +135,10 @@ var AssistDbSource = (function () {
     self.loading(true);
 
     if (refresh) {
-      ContextCatalog.getComputes({ sourceType: self.sourceType, clearCache: true });
+      contextCatalog.getComputes({ sourceType: self.sourceType, clearCache: true });
     }
 
-    return ContextCatalog.getNamespaces({ sourceType: self.sourceType, clearCache: refresh }).done(function (context) {
+    return contextCatalog.getNamespaces({ sourceType: self.sourceType, clearCache: refresh }).done(function (context) {
       var assistNamespaces = [];
       var activeNamespace;
       var activeCompute;

+ 0 - 354
desktop/core/src/desktop/static/desktop/js/contextCatalog.js

@@ -1,354 +0,0 @@
-// 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.
-
-/**
- * @typedef {Object} ContextCompute
- * @property {string} id
- * @property {string} name
- */
-
-/**
- * @typedef {Object} ContextNamespace
- * @property {string} id
- * @property {string} name
- * @property {ContextCompute} computes
- */
-
-var ContextCatalog = (function () {
-
-  var STORAGE_POSTFIX = LOGGED_USERNAME;
-  var CONTEXT_CATALOG_VERSION = 4;
-  var NAMESPACES_CONTEXT_TYPE = 'namespaces';
-  var COMPUTES_CONTEXT_TYPE = 'computes';
-  var DISABLE_CACHE = true;
-
-  var ContextCatalog = (function () {
-
-    function ContextCatalog() {
-      var self = this;
-      self.namespaces = {};
-      self.namespacePromises = {};
-
-      self.computes = {};
-      self.computePromises = {};
-
-      self.clusters = {};
-      self.clusterPromises = {};
-
-      var addPubSubs = function () {
-        if (typeof huePubSub !== 'undefined') {
-          huePubSub.subscribe('context.catalog.refresh', function () {
-            var namespacesToRefresh = Object.keys(self.namespaces);
-            self.namespaces = {};
-            self.namespacePromises = {};
-
-            self.computes = {};
-            self.computePromises = {};
-
-            self.clusters = {};
-            self.clusterPromises = {};
-            huePubSub.publish('context.catalog.refreshed');
-            namespacesToRefresh.forEach(function (sourceType) {
-              huePubSub.publish('context.catalog.namespaces.refreshed', sourceType);
-            })
-          })
-        } else {
-          window.setTimeout(addPubSubs, 100);
-        }
-      };
-
-      addPubSubs();
-    }
-
-    ContextCatalog.prototype.getStore = function () {
-      if (!self.store) {
-        self.store = localforage.createInstance({
-          name: 'HueContextCatalog_' + STORAGE_POSTFIX
-        });
-      }
-      return self.store;
-    };
-
-    ContextCatalog.prototype.saveLater = function (contextType, sourceType, entry) {
-      var self = this;
-      window.setTimeout(function () {
-        self.getStore().setItem(sourceType + '_' + contextType, { version: CONTEXT_CATALOG_VERSION, entry: entry });
-      }, 1000);
-    };
-
-    ContextCatalog.prototype.getSaved = function (contextType, sourceType) {
-      var self = this;
-      var deferred = $.Deferred();
-
-      if (DISABLE_CACHE) {
-        return deferred.reject().promise();
-      }
-
-      self.getStore().getItem(sourceType + '_' + contextType).then(function (saved) {
-        if (saved && saved.version === CONTEXT_CATALOG_VERSION) {
-          deferred.resolve(saved.entry);
-        } else {
-          deferred.reject();
-        }
-      }).catch(function (error) {
-        console.warn(error);
-        deferred.reject();
-      });
-
-      return deferred.promise();
-    };
-
-    /**
-     * @param {Object} options
-     * @param {string} options.sourceType
-     * @param {boolean} [options.clearCache] - Default False
-     * @param {boolean} [options.silenceErrors] - Default False
-     * @return {Promise}
-     */
-    ContextCatalog.prototype.getNamespaces = function (options) {
-      var self = this;
-
-      var notifyForRefresh = self.namespacePromises[options.sourceType] && options.clearCache;
-      if (options.clearCache) {
-        self.namespacePromises[options.sourceType] = undefined;
-        self.namespaces[options.sourceType] = undefined;
-      }
-
-      if (self.namespacePromises[options.sourceType]) {
-        return self.namespacePromises[options.sourceType];
-      }
-
-      if (self.namespaces[options.sourceType]) {
-        self.namespacePromises[options.sourceType] = $.Deferred().resolve(self.namespaces[options.sourceType]).promise();
-        return self.namespacePromises[options.sourceType];
-      }
-
-      var deferred = $.Deferred();
-
-      self.namespacePromises[options.sourceType] = deferred.promise();
-
-      var startingNamespaces = {};
-      var pollTimeout = -1;
-
-      var pollForStarted = function () {
-        window.clearTimeout(pollTimeout);
-        window.setTimeout(function () {
-          if (Object.keys(startingNamespaces).length) {
-            window.apiHelper.fetchContextNamespaces(options).done(function (namespaces) {
-              if (namespaces[options.sourceType]) {
-                var namespaces = namespaces[options.sourceType];
-                if (namespaces) {
-                  var statusChanged = false;
-                  namespaces.forEach(function (namespace) {
-                    if (startingNamespaces[namespace.id] && namespace.status !== 'STARTING') {
-                      startingNamespaces[namespace.id].status = namespace.status;
-                      delete startingNamespaces[namespace.id];
-                      statusChanged = true;
-                    }
-                  });
-                  if (statusChanged) {
-                    huePubSub.publish('context.catalog.namespaces.refreshed', options.sourceType);
-                  }
-                  if (Object.keys(startingNamespaces).length) {
-                    pollForStarted();
-                  }
-                }
-              }
-            });
-          }
-        }, 2000);
-      };
-
-      deferred.done(function (context) {
-        context.namespaces.forEach(function (namespace) {
-          if (namespace.status === 'STARTING') {
-            startingNamespaces[namespace.id] = namespace;
-          }
-        });
-        if (Object.keys(startingNamespaces).length) {
-          pollForStarted();
-        }
-      });
-
-      var fetchNamespaces = function () {
-        window.apiHelper.fetchContextNamespaces(options).done(function (namespaces) {
-          if (namespaces[options.sourceType]) {
-            var dynamic = namespaces.dynamicClusters;
-            var namespaces = namespaces[options.sourceType];
-            if (namespaces) {
-              namespaces.forEach(function (namespace) {
-                namespace.computes.forEach(function (compute) {
-                  if (!compute.id && compute.crn) {
-                    compute.id = compute.crn;
-                  }
-                  if (!compute.name && compute.clusterName) {
-                    compute.name = compute.clusterName;
-                  }
-                })
-              });
-              self.namespaces[options.sourceType] = { namespaces: namespaces.filter(function (namespace) {
-                return namespace.name; // Only include namespaces with a name.
-              }), dynamic: dynamic, hueTimestamp: Date.now() };
-              deferred.resolve(self.namespaces[options.sourceType]);
-              if (notifyForRefresh) {
-                huePubSub.publish('context.catalog.namespaces.refreshed', options.sourceType);
-              }
-
-              if (self.namespaces[options.sourceType].namespaces.length) {
-                self.saveLater(NAMESPACES_CONTEXT_TYPE, options.sourceType, self.namespaces[options.sourceType]);
-              } else {
-                self.getStore().removeItem(options.sourceType + '_' + NAMESPACES_CONTEXT_TYPE);
-              }
-            } else {
-              deferred.reject();
-            }
-          } else {
-            deferred.reject();
-          }
-        });
-      };
-
-      if (!options.clearCache) {
-        self.getSaved(NAMESPACES_CONTEXT_TYPE, options.sourceType).done(function (namespaces) {
-          self.namespaces[options.sourceType] = namespaces;
-          deferred.resolve(self.namespaces[options.sourceType]);
-        }).fail(fetchNamespaces);
-      } else {
-        fetchNamespaces();
-      }
-
-      return self.namespacePromises[options.sourceType];
-    };
-
-    /**
-     * @param {Object} options
-     * @param {string} options.sourceType
-     * @param {boolean} [options.silenceErrors] - Default False
-     * @param {boolean} [options.clearCache] - Default False
-     * @return {Promise}
-     */
-    ContextCatalog.prototype.getComputes = function (options) {
-      var self = this;
-
-      if (options.clearCache) {
-        self.computePromises[options.sourceType] = undefined;
-        self.computes[options.sourceType] = undefined;
-      }
-
-      if (self.computePromises[options.sourceType]) {
-        return self.computePromises[options.sourceType];
-      }
-
-      if (self.computes[options.sourceType]) {
-        self.computePromises[options.sourceType] = $.Deferred().resolve(self.computes[options.sourceType]).promise();
-        return self.computePromises[options.sourceType];
-      }
-
-      var deferred = $.Deferred();
-      self.computePromises[options.sourceType] = deferred.promise();
-
-      window.apiHelper.fetchContextComputes(options).done(function (computes) {
-        if (computes[options.sourceType]) {
-          var computes = computes[options.sourceType];
-          if (computes) {
-            self.computes[options.sourceType] = computes;
-            deferred.resolve(self.computes[options.sourceType])
-            // TODO: save
-          } else {
-            deferred.reject();
-          }
-        } else {
-          deferred.reject();
-        }
-      });
-
-      return self.computePromises[options.sourceType];
-    };
-
-    /**
-     * @param {Object} options
-     * @param {string} options.sourceType
-     * @param {boolean} [options.silenceErrors] - Default False
-     * @return {Promise}
-     */
-    ContextCatalog.prototype.getClusters = function (options) {
-      var self = this;
-
-      if (self.clusterPromises[options.sourceType]) {
-        return self.clusterPromises[options.sourceType];
-      }
-
-      if (self.clusters[options.sourceType]) {
-        self.clusterPromises[options.sourceType] = $.Deferred().resolve(self.clusters[options.sourceType]).promise();
-        return self.clusterPromises[options.sourceType];
-      }
-
-      var deferred = $.Deferred();
-      self.clusterPromises[options.sourceType] = deferred.promise();
-
-      window.apiHelper.fetchContextClusters(options).done(function (clusters) {
-        if (clusters && clusters[options.sourceType]) {
-          self.clusters[options.sourceType] = clusters[options.sourceType];
-          deferred.resolve(self.clusters[options.sourceType])
-        } else {
-          deferred.reject();
-        }
-      });
-
-      return self.clusterPromises[options.sourceType];
-    };
-
-    return ContextCatalog;
-  })();
-
-  return (function () {
-    var contextCatalog = new ContextCatalog();
-
-    return {
-
-      /**
-       * @param {Object} options
-       * @param {string} options.sourceType
-       * @param {boolean} [options.clearCache] - Default False
-       * @param {boolean} [options.silenceErrors] - Default False
-       * @return {Promise}
-       */
-      getNamespaces: function (options) {
-        return contextCatalog.getNamespaces(options);
-      },
-
-      /**
-       * @param {Object} options
-       * @param {string} options.sourceType
-       * @param {boolean} [options.silenceErrors] - Default False
-       * @return {Promise}
-       */
-      getComputes: function (options) {
-        return contextCatalog.getComputes(options);
-      },
-
-      /**
-       * @param {Object} options
-       * @param {string} options.sourceType // TODO: rename?
-       * @param {boolean} [options.silenceErrors] - Default False
-       * @return {Promise}
-       */
-      getClusters: function (options) {
-        return contextCatalog.getClusters(options);
-      }
-    }
-  })();
-})();

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/hue-bundle-4db50f164ec4ddffd941.js.map


+ 431 - 34
desktop/core/src/desktop/static/desktop/js/hue-bundle-4db50f164ec4ddffd941.js → desktop/core/src/desktop/static/desktop/js/hue-bundle-fbeb7ee72f1233caa7d8.js

@@ -2801,6 +2801,398 @@ var applyCancellable = function applyCancellable(promise, options) {
 
 /***/ }),
 
+/***/ "./desktop/core/src/desktop/js/catalog/contextCatalog.js":
+/*!***************************************************************!*\
+  !*** ./desktop/core/src/desktop/js/catalog/contextCatalog.js ***!
+  \***************************************************************/
+/*! exports provided: default */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js-exposed");
+/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
+/* harmony import */ var localforage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! localforage */ "./node_modules/localforage/dist/localforage.js");
+/* harmony import */ var localforage__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(localforage__WEBPACK_IMPORTED_MODULE_1__);
+/* harmony import */ var _api_apiHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../api/apiHelper */ "./desktop/core/src/desktop/js/api/apiHelper.js");
+/* harmony import */ var _utils_huePubSub__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/huePubSub */ "./desktop/core/src/desktop/js/utils/huePubSub.js");
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+// 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.
+
+
+
+
+/**
+ * @typedef {Object} ContextCompute
+ * @property {string} id
+ * @property {string} name
+ */
+
+/**
+ * @typedef {Object} ContextNamespace
+ * @property {string} id
+ * @property {string} name
+ * @property {ContextCompute} computes
+ */
+
+var STORAGE_POSTFIX = LOGGED_USERNAME;
+var CONTEXT_CATALOG_VERSION = 4;
+var NAMESPACES_CONTEXT_TYPE = 'namespaces';
+var DISABLE_CACHE = true;
+
+var ContextCatalog =
+/*#__PURE__*/
+function () {
+  function ContextCatalog() {
+    _classCallCheck(this, ContextCatalog);
+
+    var self = this;
+    self.namespaces = {};
+    self.namespacePromises = {};
+    self.computes = {};
+    self.computePromises = {};
+    self.clusters = {};
+    self.clusterPromises = {};
+
+    var addPubSubs = function addPubSubs() {
+      if (typeof _utils_huePubSub__WEBPACK_IMPORTED_MODULE_3__["default"] !== 'undefined') {
+        _utils_huePubSub__WEBPACK_IMPORTED_MODULE_3__["default"].subscribe('context.catalog.refresh', function () {
+          var namespacesToRefresh = Object.keys(self.namespaces);
+          self.namespaces = {};
+          self.namespacePromises = {};
+          self.computes = {};
+          self.computePromises = {};
+          self.clusters = {};
+          self.clusterPromises = {};
+          _utils_huePubSub__WEBPACK_IMPORTED_MODULE_3__["default"].publish('context.catalog.refreshed');
+          namespacesToRefresh.forEach(function (sourceType) {
+            _utils_huePubSub__WEBPACK_IMPORTED_MODULE_3__["default"].publish('context.catalog.namespaces.refreshed', sourceType);
+          });
+        });
+      } else {
+        window.setTimeout(addPubSubs, 100);
+      }
+    };
+
+    addPubSubs();
+  }
+
+  _createClass(ContextCatalog, [{
+    key: "getStore",
+    value: function getStore() {
+      if (!self.store) {
+        self.store = localforage__WEBPACK_IMPORTED_MODULE_1___default.a.createInstance({
+          name: 'HueContextCatalog_' + STORAGE_POSTFIX
+        });
+      }
+
+      return self.store;
+    }
+  }, {
+    key: "saveLater",
+    value: function saveLater(contextType, sourceType, entry) {
+      var self = this;
+      window.setTimeout(function () {
+        self.getStore().setItem(sourceType + '_' + contextType, {
+          version: CONTEXT_CATALOG_VERSION,
+          entry: entry
+        });
+      }, 1000);
+    }
+  }, {
+    key: "getSaved",
+    value: function getSaved(contextType, sourceType) {
+      var self = this;
+      var deferred = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred();
+
+      if (DISABLE_CACHE) {
+        return deferred.reject().promise();
+      }
+
+      self.getStore().getItem(sourceType + '_' + contextType).then(function (saved) {
+        if (saved && saved.version === CONTEXT_CATALOG_VERSION) {
+          deferred.resolve(saved.entry);
+        } else {
+          deferred.reject();
+        }
+      }).catch(function (error) {
+        console.warn(error);
+        deferred.reject();
+      });
+      return deferred.promise();
+    }
+  }, {
+    key: "getNamespaces",
+
+    /**
+     * @param {Object} options
+     * @param {string} options.sourceType
+     * @param {boolean} [options.clearCache] - Default False
+     * @param {boolean} [options.silenceErrors] - Default False
+     * @return {Promise}
+     */
+    value: function getNamespaces(options) {
+      var self = this;
+      var notifyForRefresh = self.namespacePromises[options.sourceType] && options.clearCache;
+
+      if (options.clearCache) {
+        self.namespacePromises[options.sourceType] = undefined;
+        self.namespaces[options.sourceType] = undefined;
+      }
+
+      if (self.namespacePromises[options.sourceType]) {
+        return self.namespacePromises[options.sourceType];
+      }
+
+      if (self.namespaces[options.sourceType]) {
+        self.namespacePromises[options.sourceType] = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred().resolve(self.namespaces[options.sourceType]).promise();
+        return self.namespacePromises[options.sourceType];
+      }
+
+      var deferred = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred();
+      self.namespacePromises[options.sourceType] = deferred.promise();
+      var startingNamespaces = {};
+      var pollTimeout = -1;
+
+      var pollForStarted = function pollForStarted() {
+        window.clearTimeout(pollTimeout);
+        window.setTimeout(function () {
+          if (Object.keys(startingNamespaces).length) {
+            _api_apiHelper__WEBPACK_IMPORTED_MODULE_2__["default"].fetchContextNamespaces(options).done(function (namespaces) {
+              if (namespaces[options.sourceType]) {
+                var _namespaces = _namespaces[options.sourceType];
+
+                if (_namespaces) {
+                  var statusChanged = false;
+
+                  _namespaces.forEach(function (namespace) {
+                    if (startingNamespaces[namespace.id] && namespace.status !== 'STARTING') {
+                      startingNamespaces[namespace.id].status = namespace.status;
+                      delete startingNamespaces[namespace.id];
+                      statusChanged = true;
+                    }
+                  });
+
+                  if (statusChanged) {
+                    _utils_huePubSub__WEBPACK_IMPORTED_MODULE_3__["default"].publish('context.catalog.namespaces.refreshed', options.sourceType);
+                  }
+
+                  if (Object.keys(startingNamespaces).length) {
+                    pollForStarted();
+                  }
+                }
+              }
+            });
+          }
+        }, 2000);
+      };
+
+      deferred.done(function (context) {
+        context.namespaces.forEach(function (namespace) {
+          if (namespace.status === 'STARTING') {
+            startingNamespaces[namespace.id] = namespace;
+          }
+        });
+
+        if (Object.keys(startingNamespaces).length) {
+          pollForStarted();
+        }
+      });
+
+      var fetchNamespaces = function fetchNamespaces() {
+        _api_apiHelper__WEBPACK_IMPORTED_MODULE_2__["default"].fetchContextNamespaces(options).done(function (namespaces) {
+          if (namespaces[options.sourceType]) {
+            var dynamic = namespaces.dynamicClusters;
+            namespaces = namespaces[options.sourceType];
+
+            if (namespaces) {
+              namespaces.forEach(function (namespace) {
+                namespace.computes.forEach(function (compute) {
+                  if (!compute.id && compute.crn) {
+                    compute.id = compute.crn;
+                  }
+
+                  if (!compute.name && compute.clusterName) {
+                    compute.name = compute.clusterName;
+                  }
+                });
+              });
+              self.namespaces[options.sourceType] = {
+                namespaces: namespaces.filter(function (namespace) {
+                  return namespace.name;
+                }),
+                dynamic: dynamic,
+                hueTimestamp: Date.now()
+              };
+              deferred.resolve(self.namespaces[options.sourceType]);
+
+              if (notifyForRefresh) {
+                _utils_huePubSub__WEBPACK_IMPORTED_MODULE_3__["default"].publish('context.catalog.namespaces.refreshed', options.sourceType);
+              }
+
+              if (self.namespaces[options.sourceType].namespaces.length) {
+                self.saveLater(NAMESPACES_CONTEXT_TYPE, options.sourceType, self.namespaces[options.sourceType]);
+              } else {
+                self.getStore().removeItem(options.sourceType + '_' + NAMESPACES_CONTEXT_TYPE);
+              }
+            } else {
+              deferred.reject();
+            }
+          } else {
+            deferred.reject();
+          }
+        });
+      };
+
+      if (!options.clearCache) {
+        self.getSaved(NAMESPACES_CONTEXT_TYPE, options.sourceType).done(function (namespaces) {
+          self.namespaces[options.sourceType] = namespaces;
+          deferred.resolve(self.namespaces[options.sourceType]);
+        }).fail(fetchNamespaces);
+      } else {
+        fetchNamespaces();
+      }
+
+      return self.namespacePromises[options.sourceType];
+    }
+  }, {
+    key: "getComputes",
+
+    /**
+     * @param {Object} options
+     * @param {string} options.sourceType
+     * @param {boolean} [options.silenceErrors] - Default False
+     * @param {boolean} [options.clearCache] - Default False
+     * @return {Promise}
+     */
+    value: function getComputes(options) {
+      var self = this;
+
+      if (options.clearCache) {
+        self.computePromises[options.sourceType] = undefined;
+        self.computes[options.sourceType] = undefined;
+      }
+
+      if (self.computePromises[options.sourceType]) {
+        return self.computePromises[options.sourceType];
+      }
+
+      if (self.computes[options.sourceType]) {
+        self.computePromises[options.sourceType] = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred().resolve(self.computes[options.sourceType]).promise();
+        return self.computePromises[options.sourceType];
+      }
+
+      var deferred = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred();
+      self.computePromises[options.sourceType] = deferred.promise();
+      _api_apiHelper__WEBPACK_IMPORTED_MODULE_2__["default"].fetchContextComputes(options).done(function (computes) {
+        if (computes[options.sourceType]) {
+          computes = computes[options.sourceType];
+
+          if (computes) {
+            self.computes[options.sourceType] = computes;
+            deferred.resolve(self.computes[options.sourceType]); // TODO: save
+          } else {
+            deferred.reject();
+          }
+        } else {
+          deferred.reject();
+        }
+      });
+      return self.computePromises[options.sourceType];
+    }
+  }, {
+    key: "getClusters",
+
+    /**
+     * @param {Object} options
+     * @param {string} options.sourceType
+     * @param {boolean} [options.silenceErrors] - Default False
+     * @return {Promise}
+     */
+    value: function getClusters(options) {
+      var self = this;
+
+      if (self.clusterPromises[options.sourceType]) {
+        return self.clusterPromises[options.sourceType];
+      }
+
+      if (self.clusters[options.sourceType]) {
+        self.clusterPromises[options.sourceType] = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred().resolve(self.clusters[options.sourceType]).promise();
+        return self.clusterPromises[options.sourceType];
+      }
+
+      var deferred = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred();
+      self.clusterPromises[options.sourceType] = deferred.promise();
+      _api_apiHelper__WEBPACK_IMPORTED_MODULE_2__["default"].fetchContextClusters(options).done(function (clusters) {
+        if (clusters && clusters[options.sourceType]) {
+          self.clusters[options.sourceType] = clusters[options.sourceType];
+          deferred.resolve(self.clusters[options.sourceType]);
+        } else {
+          deferred.reject();
+        }
+      });
+      return self.clusterPromises[options.sourceType];
+    }
+  }]);
+
+  return ContextCatalog;
+}();
+
+var contextCatalog = new ContextCatalog();
+/* harmony default export */ __webpack_exports__["default"] = ({
+  /**
+   * @param {Object} options
+   * @param {string} options.sourceType
+   * @param {boolean} [options.clearCache] - Default False
+   * @param {boolean} [options.silenceErrors] - Default False
+   * @return {Promise}
+   */
+  getNamespaces: function getNamespaces(options) {
+    return contextCatalog.getNamespaces(options);
+  },
+
+  /**
+   * @param {Object} options
+   * @param {string} options.sourceType
+   * @param {boolean} [options.silenceErrors] - Default False
+   * @return {Promise}
+   */
+  getComputes: function getComputes(options) {
+    return contextCatalog.getComputes(options);
+  },
+
+  /**
+   * @param {Object} options
+   * @param {string} options.sourceType // TODO: rename?
+   * @param {boolean} [options.silenceErrors] - Default False
+   * @return {Promise}
+   */
+  getClusters: function getClusters(options) {
+    return contextCatalog.getClusters(options);
+  }
+});
+
+/***/ }),
+
 /***/ "./desktop/core/src/desktop/js/catalog/dataCatalog.js":
 /*!************************************************************!*\
   !*** ./desktop/core/src/desktop/js/catalog/dataCatalog.js ***!
@@ -2814,11 +3206,12 @@ __webpack_require__.r(__webpack_exports__);
 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
 /* harmony import */ var localforage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! localforage */ "./node_modules/localforage/dist/localforage.js");
 /* harmony import */ var localforage__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(localforage__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var _api_cancellablePromise__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../api/cancellablePromise */ "./desktop/core/src/desktop/js/api/cancellablePromise.js");
-/* harmony import */ var _catalogUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./catalogUtils */ "./desktop/core/src/desktop/js/catalog/catalogUtils.js");
-/* harmony import */ var _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./dataCatalogEntry */ "./desktop/core/src/desktop/js/catalog/dataCatalogEntry.js");
-/* harmony import */ var _generalDataCatalog__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./generalDataCatalog */ "./desktop/core/src/desktop/js/catalog/generalDataCatalog.js");
-/* harmony import */ var _multiTableEntry__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./multiTableEntry */ "./desktop/core/src/desktop/js/catalog/multiTableEntry.js");
+/* harmony import */ var _api_apiHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../api/apiHelper */ "./desktop/core/src/desktop/js/api/apiHelper.js");
+/* harmony import */ var _api_cancellablePromise__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../api/cancellablePromise */ "./desktop/core/src/desktop/js/api/cancellablePromise.js");
+/* harmony import */ var _catalogUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./catalogUtils */ "./desktop/core/src/desktop/js/catalog/catalogUtils.js");
+/* harmony import */ var _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./dataCatalogEntry */ "./desktop/core/src/desktop/js/catalog/dataCatalogEntry.js");
+/* harmony import */ var _generalDataCatalog__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./generalDataCatalog */ "./desktop/core/src/desktop/js/catalog/generalDataCatalog.js");
+/* harmony import */ var _multiTableEntry__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./multiTableEntry */ "./desktop/core/src/desktop/js/catalog/multiTableEntry.js");
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -2847,6 +3240,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
 
 
 
+
 var STORAGE_POSTFIX = LOGGED_USERNAME;
 var DATA_CATALOG_VERSION = 5;
 var cacheEnabled = true;
@@ -3075,7 +3469,7 @@ function () {
       var cancellablePromises = [];
       var popularEntries = [];
       var pathsToLoad = [];
-      options = _catalogUtils__WEBPACK_IMPORTED_MODULE_3__["default"].setSilencedErrors(options);
+      options = _catalogUtils__WEBPACK_IMPORTED_MODULE_4__["default"].setSilencedErrors(options);
       var existingPromises = [];
       options.paths.forEach(function (path) {
         var existingDeferred = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred();
@@ -3109,7 +3503,7 @@ function () {
         var loadDeferred = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred();
 
         if (pathsToLoad.length) {
-          cancellablePromises.push(window.apiHelper.fetchNavOptPopularity({
+          cancellablePromises.push(_api_apiHelper__WEBPACK_IMPORTED_MODULE_2__["default"].fetchNavOptPopularity({
             silenceErrors: options.silenceErrors,
             paths: pathsToLoad
           }).done(function (data) {
@@ -3173,7 +3567,7 @@ function () {
           }).fail(deferred.reject);
         });
       });
-      return _catalogUtils__WEBPACK_IMPORTED_MODULE_3__["default"].applyCancellable(new _api_cancellablePromise__WEBPACK_IMPORTED_MODULE_2__["default"](deferred, cancellablePromises), options);
+      return _catalogUtils__WEBPACK_IMPORTED_MODULE_4__["default"].applyCancellable(new _api_cancellablePromise__WEBPACK_IMPORTED_MODULE_3__["default"](deferred, cancellablePromises), options);
     }
   }, {
     key: "getKnownEntry",
@@ -3240,7 +3634,7 @@ function () {
       if (!self.temporaryEntries[sourceIdentifier]) {
         var sourceDeferred = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred();
         self.temporaryEntries[sourceIdentifier] = sourceDeferred.promise();
-        var sourceEntry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_4__["default"]({
+        var sourceEntry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_5__["default"]({
           isTemporary: true,
           dataCatalog: self,
           namespace: options.namespace,
@@ -3268,7 +3662,7 @@ function () {
           if (!self.temporaryEntries[databaseIdentifier]) {
             var databaseDeferred = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred();
             self.temporaryEntries[databaseIdentifier] = databaseDeferred.promise();
-            var databaseEntry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_4__["default"]({
+            var databaseEntry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_5__["default"]({
               isTemporary: true,
               dataCatalog: self,
               namespace: options.namespace,
@@ -3295,7 +3689,7 @@ function () {
               });
               self.temporaryEntries[tableIdentifier] = tableDeferred.promise();
               identifiersToClean.push(tableIdentifier);
-              var tableEntry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_4__["default"]({
+              var tableEntry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_5__["default"]({
                 isTemporary: true,
                 dataCatalog: self,
                 namespace: options.namespace,
@@ -3343,7 +3737,7 @@ function () {
                   var columnDeferred = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Deferred();
                   self.temporaryEntries[columnIdentifier] = columnDeferred.promise();
                   identifiersToClean.push(columnIdentifier);
-                  var columnEntry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_4__["default"]({
+                  var columnEntry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_5__["default"]({
                     isTemporary: true,
                     dataCatalog: self,
                     namespace: options.namespace,
@@ -3430,7 +3824,7 @@ function () {
       self.entries[identifier] = deferred.promise();
 
       if (!cacheEnabled) {
-        deferred.resolve(new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_4__["default"]({
+        deferred.resolve(new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_5__["default"]({
           dataCatalog: self,
           namespace: options.namespace,
           compute: options.compute,
@@ -3440,7 +3834,7 @@ function () {
       } else {
         self.store.getItem(identifier).then(function (storeEntry) {
           var definition = storeEntry ? storeEntry.definition : options.definition;
-          var entry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_4__["default"]({
+          var entry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_5__["default"]({
             dataCatalog: self,
             namespace: options.namespace,
             compute: options.compute,
@@ -3457,7 +3851,7 @@ function () {
           deferred.resolve(entry);
         }).catch(function (error) {
           console.warn(error);
-          var entry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_4__["default"]({
+          var entry = new _dataCatalogEntry__WEBPACK_IMPORTED_MODULE_5__["default"]({
             dataCatalog: self,
             namespace: options.namespace,
             compute: options.compute,
@@ -3499,14 +3893,14 @@ function () {
       self.multiTableEntries[identifier] = deferred.promise();
 
       if (!cacheEnabled) {
-        deferred.resolve(new _multiTableEntry__WEBPACK_IMPORTED_MODULE_6__["default"]({
+        deferred.resolve(new _multiTableEntry__WEBPACK_IMPORTED_MODULE_7__["default"]({
           identifier: identifier,
           dataCatalog: self,
           paths: options.paths
         })).promise();
       } else {
         self.multiTableStore.getItem(identifier).then(function (storeEntry) {
-          var entry = new _multiTableEntry__WEBPACK_IMPORTED_MODULE_6__["default"]({
+          var entry = new _multiTableEntry__WEBPACK_IMPORTED_MODULE_7__["default"]({
             identifier: identifier,
             dataCatalog: self,
             paths: options.paths
@@ -3519,7 +3913,7 @@ function () {
           deferred.resolve(entry);
         }).catch(function (error) {
           console.warn(error);
-          deferred.resolve(new _multiTableEntry__WEBPACK_IMPORTED_MODULE_6__["default"]({
+          deferred.resolve(new _multiTableEntry__WEBPACK_IMPORTED_MODULE_7__["default"]({
             identifier: identifier,
             dataCatalog: self,
             paths: options.paths
@@ -3574,7 +3968,7 @@ function () {
   return DataCatalog;
 }();
 
-var generalDataCatalog = new _generalDataCatalog__WEBPACK_IMPORTED_MODULE_5__["default"]();
+var generalDataCatalog = new _generalDataCatalog__WEBPACK_IMPORTED_MODULE_6__["default"]();
 var sourceBoundCatalogs = {};
 /**
  * Helper function to get the DataCatalog instance for a given data source.
@@ -3666,7 +4060,7 @@ var getCatalog = function getCatalog(sourceType) {
     getCatalog(options.sourceType).getEntry(options).done(function (entry) {
       cancellablePromises.push(entry.getChildren(options).done(deferred.resolve).fail(deferred.reject));
     }).fail(deferred.reject);
-    return new _api_cancellablePromise__WEBPACK_IMPORTED_MODULE_2__["default"](deferred, undefined, cancellablePromises);
+    return new _api_cancellablePromise__WEBPACK_IMPORTED_MODULE_3__["default"](deferred, undefined, cancellablePromises);
   },
 
   /**
@@ -3696,7 +4090,7 @@ var getCatalog = function getCatalog(sourceType) {
   disableCache: function disableCache() {
     cacheEnabled = false;
   },
-  applyCancellable: _catalogUtils__WEBPACK_IMPORTED_MODULE_3__["default"].applyCancellable
+  applyCancellable: _catalogUtils__WEBPACK_IMPORTED_MODULE_4__["default"].applyCancellable
 });
 
 /***/ }),
@@ -14165,12 +14559,13 @@ __webpack_require__.r(__webpack_exports__);
 /* harmony import */ var knockout_validation__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(knockout_validation__WEBPACK_IMPORTED_MODULE_13__);
 /* harmony import */ var api_apiHelper__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! api/apiHelper */ "./desktop/core/src/desktop/js/api/apiHelper.js");
 /* harmony import */ var api_cancellablePromise__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! api/cancellablePromise */ "./desktop/core/src/desktop/js/api/cancellablePromise.js");
-/* harmony import */ var catalog_dataCatalog__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! catalog/dataCatalog */ "./desktop/core/src/desktop/js/catalog/dataCatalog.js");
-/* harmony import */ var utils_hueAnalytics__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! utils/hueAnalytics */ "./desktop/core/src/desktop/js/utils/hueAnalytics.js");
-/* harmony import */ var utils_hueDebug__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! utils/hueDebug */ "./desktop/core/src/desktop/js/utils/hueDebug.js");
-/* harmony import */ var utils_hueDrop__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! utils/hueDrop */ "./desktop/core/src/desktop/js/utils/hueDrop.js");
-/* harmony import */ var utils_huePubSub__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! utils/huePubSub */ "./desktop/core/src/desktop/js/utils/huePubSub.js");
-/* harmony import */ var utils_hueUtils__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! utils/hueUtils */ "./desktop/core/src/desktop/js/utils/hueUtils.js");
+/* harmony import */ var catalog_contextCatalog__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! catalog/contextCatalog */ "./desktop/core/src/desktop/js/catalog/contextCatalog.js");
+/* harmony import */ var catalog_dataCatalog__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! catalog/dataCatalog */ "./desktop/core/src/desktop/js/catalog/dataCatalog.js");
+/* harmony import */ var utils_hueAnalytics__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! utils/hueAnalytics */ "./desktop/core/src/desktop/js/utils/hueAnalytics.js");
+/* harmony import */ var utils_hueDebug__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! utils/hueDebug */ "./desktop/core/src/desktop/js/utils/hueDebug.js");
+/* harmony import */ var utils_hueDrop__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! utils/hueDrop */ "./desktop/core/src/desktop/js/utils/hueDrop.js");
+/* harmony import */ var utils_huePubSub__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! utils/huePubSub */ "./desktop/core/src/desktop/js/utils/huePubSub.js");
+/* harmony import */ var utils_hueUtils__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! utils/hueUtils */ "./desktop/core/src/desktop/js/utils/hueUtils.js");
 // Licensed to Cloudera, Inc. under one
 // or more contributor license agreements.  See the NOTICE file
 // distributed with this work for additional information
@@ -14205,6 +14600,7 @@ __webpack_require__.r(__webpack_exports__);
 
 
 
+
 
 
  // TODO: Migrate away
@@ -14212,13 +14608,14 @@ __webpack_require__.r(__webpack_exports__);
 window._ = lodash__WEBPACK_IMPORTED_MODULE_2___default.a;
 window.apiHelper = api_apiHelper__WEBPACK_IMPORTED_MODULE_14__["default"];
 window.CancellablePromise = api_cancellablePromise__WEBPACK_IMPORTED_MODULE_15__["default"];
-window.dataCatalog = catalog_dataCatalog__WEBPACK_IMPORTED_MODULE_16__["default"];
+window.contextCatalog = catalog_contextCatalog__WEBPACK_IMPORTED_MODULE_16__["default"];
+window.dataCatalog = catalog_dataCatalog__WEBPACK_IMPORTED_MODULE_17__["default"];
 window.filesize = filesize__WEBPACK_IMPORTED_MODULE_3___default.a;
-window.hueUtils = utils_hueUtils__WEBPACK_IMPORTED_MODULE_21__["default"];
-window.hueAnalytics = utils_hueAnalytics__WEBPACK_IMPORTED_MODULE_17__["default"];
-window.hueDebug = utils_hueDebug__WEBPACK_IMPORTED_MODULE_18__["default"];
-window.huePubSub = utils_huePubSub__WEBPACK_IMPORTED_MODULE_20__["default"];
-window.hueDrop = utils_hueDrop__WEBPACK_IMPORTED_MODULE_19__["default"];
+window.hueUtils = utils_hueUtils__WEBPACK_IMPORTED_MODULE_22__["default"];
+window.hueAnalytics = utils_hueAnalytics__WEBPACK_IMPORTED_MODULE_18__["default"];
+window.hueDebug = utils_hueDebug__WEBPACK_IMPORTED_MODULE_19__["default"];
+window.huePubSub = utils_huePubSub__WEBPACK_IMPORTED_MODULE_21__["default"];
+window.hueDrop = utils_hueDrop__WEBPACK_IMPORTED_MODULE_20__["default"];
 window.ko = knockout__WEBPACK_IMPORTED_MODULE_7___default.a;
 window.ko.mapping = knockout_mapping__WEBPACK_IMPORTED_MODULE_8___default.a;
 window.localforage = localforage__WEBPACK_IMPORTED_MODULE_6___default.a;
@@ -67872,4 +68269,4 @@ module.exports = __webpack_require__(/*! ./desktop/core/src/desktop/js/hue.js */
 /***/ })
 
 /******/ });
-//# sourceMappingURL=hue-bundle-4db50f164ec4ddffd941.js.map
+//# sourceMappingURL=hue-bundle-fbeb7ee72f1233caa7d8.js.map

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/hue-bundle-fbeb7ee72f1233caa7d8.js.map


+ 1 - 1
desktop/core/src/desktop/static/desktop/js/jquery.hiveautocomplete.js

@@ -53,7 +53,7 @@
     if (self.options.namespace) {
       self.namespaceDeferred.resolve(self.options.namespace);
     } else {
-      ContextCatalog.getNamespaces({ sourceType: options.apiHelperType }).done(function (context) {
+      contextCatalog.getNamespaces({ sourceType: options.apiHelperType }).done(function (context) {
         if (context.namespaces && context.namespaces.length) {
           self.namespaceDeferred.resolve(context.namespaces[0]);
         } else {

+ 0 - 1
desktop/core/src/desktop/templates/hue.mako

@@ -133,7 +133,6 @@
   <script src="${ static('desktop/js/hue.errorcatcher.js') }"></script>
   % endif
   <script src="${ static('desktop/js/hue4.utils.js') }"></script>
-  <script src="${ static('desktop/js/contextCatalog.js') }"></script>
 </head>
 
 <body>

+ 1 - 1
desktop/core/src/desktop/templates/ko_components/ko_context_popover.mako

@@ -1582,7 +1582,7 @@ from metadata.conf import has_navigator
         }
 
         if (self.isCatalogEntry) {
-          ContextCatalog.getNamespaces({ sourceType: sourceType }).done(function (context) {
+          contextCatalog.getNamespaces({ sourceType: sourceType }).done(function (context) {
             // TODO: Namespace and compute selection for global search results?
             dataCatalog.getEntry({ sourceType: sourceType, namespace: context.namespaces[0], compute: context.namespaces[0].computes[0], path: path, definition: { type: params.data.type.toLowerCase() }}).done(function (catalogEntry) {
               catalogEntry.navigatorMeta = params.data;

+ 1 - 1
desktop/core/src/desktop/templates/ko_components/ko_context_selector.mako

@@ -278,7 +278,7 @@ from desktop.views import _ko
         var self = this;
         if (self[type.name]) {
           self[type.loading](true);
-          self[type.lastPromise] = ContextCatalog[type.contextCatalogFn]({
+          self[type.lastPromise] = contextCatalog[type.contextCatalogFn]({
             sourceType: ko.unwrap(self.sourceType)
           }).done(function (available) {
             // Namespaces response differs slightly from the others

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

@@ -559,7 +559,7 @@ var Collection = function (vm, collection) {
   self.activeNamespace = ko.observable();
   self.activeCompute = ko.observable();
 
-  ContextCatalog.getNamespaces({ sourceType: collection.engine || 'solr' }).done(function (context) {
+  contextCatalog.getNamespaces({ sourceType: collection.engine || 'solr' }).done(function (context) {
     // TODO: Namespace selection
     self.activeNamespace(context.namespaces[0]);
     self.activeCompute(context.namespaces[0].computes[0]);

+ 1 - 1
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -2500,7 +2500,7 @@ ${ assist.assistPanel() }
 
       self.computeSetDeferred = $.Deferred();
 
-      ContextCatalog.getNamespaces({ sourceType: vm.sourceType }).done(function (context) {
+      contextCatalog.getNamespaces({ sourceType: vm.sourceType }).done(function (context) {
         self.namespaces(context.namespaces);
         if (!vm.namespaceId || !context.namespaces.some(function (namespace) {
           if (namespace.id === vm.namespaceId) {

+ 1 - 1
desktop/libs/indexer/src/indexer/templates/indexes.mako

@@ -650,7 +650,7 @@ ${ assist.assistPanel() }
       self.activeNamespace = ko.observable();
       self.activeCompute = ko.observable();
 
-      ContextCatalog.getNamespaces({ sourceType: 'solr' }).done(function (context) {
+      contextCatalog.getNamespaces({ sourceType: 'solr' }).done(function (context) {
         // TODO: Namespace selection
         self.activeNamespace(context.namespaces[0]);
         self.activeCompute(context.namespaces[0].computes[0]);

+ 1 - 1
desktop/libs/indexer/src/indexer/templates/topics.mako

@@ -581,7 +581,7 @@ ${ assist.assistPanel() }
       self.activeNamespace = ko.observable();
       self.activeCompute = ko.observable();
 
-      ContextCatalog.getNamespaces({ sourceType: 'solr' }).done(function (context) {
+      contextCatalog.getNamespaces({ sourceType: 'solr' }).done(function (context) {
         // TODO: Namespace selection
         self.activeNamespace(context.namespaces[0]);
         self.activeCompute(context.namespaces[0].computes[0]);

+ 1 - 1
webpack-stats.json

@@ -1 +1 @@
-{"status":"done","chunks":{"hue":[{"name":"hue-bundle-4db50f164ec4ddffd941.js","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/hue-bundle-4db50f164ec4ddffd941.js"},{"name":"hue-bundle-4db50f164ec4ddffd941.js.map","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/hue-bundle-4db50f164ec4ddffd941.js.map"}]}}
+{"status":"done","chunks":{"hue":[{"name":"hue-bundle-fbeb7ee72f1233caa7d8.js","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/hue-bundle-fbeb7ee72f1233caa7d8.js"},{"name":"hue-bundle-fbeb7ee72f1233caa7d8.js.map","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/hue-bundle-fbeb7ee72f1233caa7d8.js.map"}]}}

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно