How to use the catalog/catalogUtils.applyCancellable function in catalog

To help you get started, we’ve selected a few catalog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalogEntry.js View on Github external
getSample(options) {
    const self = this;

    // This prevents caching of any non-standard sample queries, i.e. DISTINCT etc.
    if (options && options.operation && options.operation !== 'default') {
      return catalogUtils.applyCancellable(
        apiHelper.fetchSample({
          sourceType: self.dataCatalog.sourceType,
          compute: self.compute,
          path: self.path,
          silenceErrors: options && options.silenceErrors,
          operation: options.operation
        }),
        options
      );
    }

    // Check if parent has a sample that we can reuse
    if (!self.samplePromise && self.isColumn()) {
      const deferred = $.Deferred();
      const cancellablePromises = [];
github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalogEntry.js View on Github external
options
      );
    }

    if (options && options.cachedOnly) {
      return (
        catalogUtils.applyCancellable(self.samplePromise, options) ||
        $.Deferred()
          .reject(false)
          .promise()
      );
    }
    if (options && options.refreshCache) {
      return catalogUtils.applyCancellable(reloadSample(self, options), options);
    }
    return catalogUtils.applyCancellable(
      self.samplePromise || reloadSample(self, options),
      options
    );
  }
github cloudera / hue / desktop / core / src / desktop / js / catalog / multiTableEntry.js View on Github external
const genericNavOptGet = function(
  multiTableEntry,
  options,
  promiseAttribute,
  dataAttribute,
  apiHelperFunction
) {
  if (options && options.cachedOnly) {
    return (
      catalogUtils.applyCancellable(multiTableEntry[promiseAttribute], options) ||
      $.Deferred()
        .reject(false)
        .promise()
    );
  }
  if (options && options.refreshCache) {
    return catalogUtils.applyCancellable(
      genericNavOptReload(
        multiTableEntry,
        options,
        promiseAttribute,
        dataAttribute,
        apiHelperFunction
      ),
      options
    );
github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalogEntry.js View on Github external
const self = this;
    if (!self.isTableOrView()) {
      return $.Deferred()
        .reject(false)
        .promise();
    }
    if (options && options.cachedOnly) {
      return (
        catalogUtils.applyCancellable(self.partitionsPromise, options) ||
        $.Deferred()
          .reject(false)
          .promise()
      );
    }
    if (options && options.refreshCache) {
      return catalogUtils.applyCancellable(reloadPartitions(self, options), options);
    }
    return catalogUtils.applyCancellable(
      self.partitionsPromise || reloadPartitions(self, options),
      options
    );
  }
github cloudera / hue / desktop / core / src / desktop / js / catalog / multiTableEntry.js View on Github external
multiTableEntry,
  options,
  promiseAttribute,
  dataAttribute,
  apiHelperFunction
) {
  if (options && options.cachedOnly) {
    return (
      catalogUtils.applyCancellable(multiTableEntry[promiseAttribute], options) ||
      $.Deferred()
        .reject(false)
        .promise()
    );
  }
  if (options && options.refreshCache) {
    return catalogUtils.applyCancellable(
      genericNavOptReload(
        multiTableEntry,
        options,
        promiseAttribute,
        dataAttribute,
        apiHelperFunction
      ),
      options
    );
  }
  return catalogUtils.applyCancellable(
    multiTableEntry[promiseAttribute] ||
      genericNavOptReload(
        multiTableEntry,
        options,
        promiseAttribute,
github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalogEntry.js View on Github external
getSourceMeta(options) {
    const self = this;
    if (options && options.cachedOnly) {
      return (
        catalogUtils.applyCancellable(self.sourceMetaPromise, options) ||
        $.Deferred()
          .reject(false)
          .promise()
      );
    }
    if (options && options.refreshCache) {
      return catalogUtils.applyCancellable(reloadSourceMeta(self, options));
    }
    return catalogUtils.applyCancellable(
      self.sourceMetaPromise || reloadSourceMeta(self, options),
      options
    );
  }
github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalogEntry.js View on Github external
if (navigatorMeta) {
                deferred.resolve(
                  navigatorMeta.description || navigatorMeta.originalDescription || ''
                );
              } else {
                resolveWithSourceMeta();
              }
            })
            .fail(resolveWithSourceMeta)
        );
      }
    } else {
      resolveWithSourceMeta();
    }

    return catalogUtils.applyCancellable(
      new CancellablePromise(deferred, undefined, cancellablePromises),
      options
    );
  }
github cloudera / hue / desktop / core / src / desktop / js / catalog / dataCatalogEntry.js View on Github external
loadNavigatorMetaForChildren(options) {
    const self = this;

    options = catalogUtils.setSilencedErrors(options);

    if (!self.canHaveNavigatorMetadata() || self.isField()) {
      return $.Deferred()
        .reject()
        .promise();
    }

    if (self.navigatorMetaForChildrenPromise && (!options || !options.refreshCache)) {
      return catalogUtils.applyCancellable(self.navigatorMetaForChildrenPromise, options);
    }

    const deferred = $.Deferred();

    const cancellablePromises = [];

    cancellablePromises.push(
      self
        .getChildren(options)
        .done(children => {
          const someHaveNavMeta = children.some(childEntry => {
            return childEntry.navigatorMeta;
          });
          if (someHaveNavMeta && (!options || !options.refreshCache)) {
            deferred.resolve(children);
            return;