Procházet zdrojové kódy

HUE-7602 [assist] Remove unused AssistCollectionEntry references

Enrico Berti před 8 roky
rodič
revize
9ca4f6c

+ 0 - 173
desktop/core/src/desktop/static/desktop/js/assist/assistCollectionEntry.js

@@ -1,173 +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.
-
-var AssistCollectionEntry = (function () {
-
-  /**
-   * @param {object} options
-   * @param {object} options.definition
-   * @param {string} options.definition.name
-   * @param {ApiHelper} options.apiHelper
-   * @constructor
-   */
-  function AssistCollectionEntry (options, filter, showCores) {
-    var self = this;
-
-    self.definition = options.definition;
-    self.apiHelper = options.apiHelper;
-    self.path = self.definition.name;
-    self.parent = options.parent;
-    self.key = ko.observable(options.key);
-    self.filter = filter;
-    self.showCores = showCores;
-
-    self.entries = ko.observableArray([]);
-    self.filteredEntries = ko.pureComputed(function(){
-      var result = [];
-      $.each(self.entries(), function (index, entry) {
-        if (entry.definition.name.toLowerCase().indexOf(self.filter().toLowerCase()) > -1){
-          if (self.showCores() || (!self.showCores() && !entry.definition.isCoreOnly)){
-            result.push(entry);
-          }
-        }
-      });
-      return result;
-    });
-
-    self.loaded = false;
-    self.loading = ko.observable(false);
-    self.hasErrors = ko.observable(false);
-
-    self.hasOnlyCores = ko.computed(function () {
-      return ko.utils.arrayFilter(self.filteredEntries(), function (entry) {
-          return entry.definition.isCoreOnly;
-        }).length === self.filteredEntries().length;
-    });
-
-    self.hasEntries = ko.computed(function() {
-      return self.entries().length > 0;
-    });
-  }
-
-  AssistCollectionEntry.prototype.loadEntries = function(callback) {
-    var self = this;
-    if (self.loading()) {
-      return;
-    }
-    self.loading(true);
-    self.hasErrors(false);
-
-    var successCallback = function(data) {
-      if (data.collections) {
-        self.entries($.map(data.collections, function (collection) {
-          return new AssistCollectionEntry({
-            definition: collection,
-            parent: self,
-            apiHelper: self.apiHelper
-          }, self.filter, self.showCores)
-        }));
-      }
-      else if (data.schema && data.schema.fields) {
-        self.key(data.schema.uniqueKey);
-        self.entries($.map(data.schema.fields, function (field) {
-          return new AssistCollectionEntry({
-            definition: field,
-            parent: self,
-            apiHelper: self.apiHelper
-          }, self.filter, self.showCores)
-        }));
-      }
-      self.loaded = true;
-      self.loading(false);
-      if (callback) {
-        callback();
-      }
-    };
-
-    var errorCallback = function () {
-      self.hasErrors(true);
-      self.loading(false);
-      if (callback) {
-        callback();
-      }
-    };
-
-    if (self.path === '/') {
-      self.apiHelper.fetchSolrCollections({
-        successCallback: successCallback,
-        errorCallback: errorCallback
-      });
-    }
-    else {
-      self.apiHelper.fetchSolrCollection({
-        collectionName: self.definition.name,
-        successCallback: successCallback,
-        errorCallback: errorCallback
-      });
-    }
-
-  };
-
-  AssistCollectionEntry.prototype.showContextPopover = function (entry, event, positionAdjustment) {
-    var self = this;
-    var $source = $(event.target);
-    var offset = $source.offset();
-    if (positionAdjustment) {
-      offset.left += positionAdjustment.left;
-      offset.top += positionAdjustment.top;
-    }
-
-    huePubSub.publish('context.popover.show', {
-      data: {
-        type: 'collection',
-        definition: self.definition,
-        parent: self.parent
-      },
-      showInAssistEnabled: false,
-      orientation: 'right',
-      pinEnabled: false,
-      source: {
-        element: event.target,
-        left: offset.left,
-        top: offset.top - 3,
-        right: offset.left + $source.width() + 1,
-        bottom: offset.top + $source.height() - 3
-      }
-    });
-  };
-
-  AssistCollectionEntry.prototype.openInBrowser = function () {
-    huePubSub.publish('assist.openCollectionItem', this);
-  };
-
-  AssistCollectionEntry.prototype.openInDashboard = function () {
-    var definitionName = this.definition.name;
-    if (this.parent && this.parent.definition.name !== '/') {
-      definitionName = this.parent.definition.name;
-    }
-    huePubSub.publish('open.link', '/hue/search/browse/' + definitionName);
-  };
-
-  AssistCollectionEntry.prototype.click = function () {
-    huePubSub.publish('assist.clickCollectionItem', this);
-  };
-
-  AssistCollectionEntry.prototype.dblClick = function () {
-    huePubSub.publish('assist.dblClickCollectionItem', this);
-  };
-
-  return AssistCollectionEntry;
-})();

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

@@ -37,7 +37,6 @@ from desktop.views import _ko
 <script src="${ static('desktop/js/assist/assistDbSource.js') }"></script>
 <script src="${ static('desktop/js/assist/assistStorageEntry.js') }"></script>
 <script src="${ static('desktop/js/assist/assistGitEntry.js') }"></script>
-<script src="${ static('desktop/js/assist/assistCollectionEntry.js') }"></script>
 <script src="${ static('desktop/js/assist/assistHBaseEntry.js') }"></script>
 <script src="${ static('desktop/js/document/hueDocument.js') }"></script>
 <script src="${ static('desktop/js/document/hueFileEntry.js') }"></script>