浏览代码

[metastore] Remove old assist.js

Johan Ahlen 10 年之前
父节点
当前提交
6eb3945

+ 0 - 1
apps/metastore/src/metastore/templates/describe_table.mako

@@ -55,7 +55,6 @@ ${ assist.assistPanel() }
 % endif
 </style>
 
-<script src="${ static('notebook/js/assist.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/ext/js/d3.v3.js') }" type="text/javascript" charset="utf-8"></script>
 
 <%def name="column_table(cols, id, withStats=False, limit=10000)">

+ 0 - 138
desktop/libs/notebook/src/notebook/static/notebook/js/assist.js

@@ -1,138 +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 Assist = function (options) {
-  var self = this;
-
-  function hasExpired(timestamp) {
-    if (!timestamp) {
-      return true;
-    }
-    var TIME_TO_LIVE_IN_MILLIS = 86400000; // 1 day
-    return (new Date()).getTime() - timestamp > TIME_TO_LIVE_IN_MILLIS;
-  }
-
-  function getTotalStoragePrefix() {
-    var _app = "";
-    if (typeof options.app != "undefined") {
-      _app = options.app;
-    }
-    if (typeof options.user != "undefined") {
-      return _app + "_" + options.user + "_";
-    }
-    return (_app != "" ? _app + "_" : "");
-  }
-
-
-  function jsonCalls(force) {
-    if (typeof options.baseURL == "undefined" || options.baseURL == null) {
-      console.error("Assist should always have a baseURL set to work fine.");
-      return null;
-    }
-
-    var _url = options.baseURL;
-    if (options.firstLevel != null) {
-      _url += options.firstLevel;
-    }
-    if (options.secondLevel != null) {
-      _url += "/" + options.secondLevel;
-    }
-
-    var _cachePath = getTotalStoragePrefix() + _url;
-    var _cached = $.totalStorage(_cachePath);
-    var _returnCached = false;
-    if (_cached != null && !hasExpired(_cached.timestamp) && typeof force == "undefined") {
-      options.onDataReceived(_cached.data);
-      _returnCached = true;
-    }
-
-    if (options.onError) {
-      $.ajaxSetup({
-        error: function (x, e) {
-          if (x.status == 500) {
-            self.hasErrors(true);
-            options.onError(e);
-          }
-        }
-      });
-    }
-
-    if (!_returnCached) {
-      $.ajax({
-        type: "GET",
-        url: _url + "?" + Math.random(),
-        success: function (data) {
-          if (data.error) {
-            if (typeof options.failsSilentlyOn == "undefined" || (data.code != null && options.failsSilentlyOn.indexOf(data.code) == -1)) {
-              $.jHueNotify.error(data.error);
-            }
-          }
-          else {
-            var _obj = {
-              data: data,
-              timestamp: (new Date()).getTime()
-            }
-            $.totalStorage(_cachePath, _obj);
-            options.onDataReceived($.totalStorage(_cachePath).data);
-          }
-        },
-        error: function (error) {
-          $(document).trigger('error', error);
-        }
-      });
-    }
-
-  }
-
-  self.options = options;
-
-  self.getData = function (path, force) {
-    self.path(path);
-    self.options.firstLevel = null;
-    self.options.secondLevel = null;
-    if (path) {
-      if (path.indexOf("/") > -1) {
-        self.options.firstLevel = path.split("/")[0];
-        self.options.secondLevel = path.split("/")[1];
-      }
-      else {
-        self.options.firstLevel = path;
-      }
-    }
-    jsonCalls(force);
-  }
-
-  // ko observables
-  self.isLoading = ko.observable(true);
-  self.hasErrors = ko.observable(false);
-  self.path = ko.observable();
-  self.selectedMainObject = ko.observable();
-  self.mainObjects = ko.observableArray([]);
-  self.firstLevelObjects = ko.observable({});
-
-  self.filter = ko.observable("");
-  self.filter.extend({ rateLimit: 150 });
-  self.filteredFirstLevelObjects = ko.computed(function () {
-    var result = [];
-    var noFilter = self.filter() === "";
-    $.each(Object.keys(self.firstLevelObjects()), function(index, key) {
-      if (noFilter || key.toLowerCase().indexOf(self.filter()) > -1) {
-        result.push(self.firstLevelObjects()[key]);
-      }
-    });
-    return result;
-  });
-}

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

@@ -43,8 +43,6 @@ from desktop.views import _ko
 <script src="${ static('desktop/ext/js/bootstrap-editable.min.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/ext/chosen/chosen.jquery.min.js') }" type="text/javascript" charset="utf-8"></script>
 
-<script src="${ static('notebook/js/assist.js') }" type="text/javascript" charset="utf-8"></script>
-
 <script src="${ static('desktop/js/hue.geo.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/js/hue.colors.js') }" type="text/javascript" charset="utf-8"></script>