瀏覽代碼

HUE-5582 [fb] Get rid of chooser.mako

Enrico Berti 9 年之前
父節點
當前提交
6779ac0bc4

+ 0 - 24
apps/filebrowser/src/filebrowser/templates/chooser.mako

@@ -1,24 +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.
-
-<%namespace name="dir" file="listdir_components.mako" />
-
-<div class="fb-actions">
-  <a class="fb-upload" data-icon-styles="{'width': 16, 'height' : 16}" href="${url('filebrowser.views.upload_file')}?dest=${path|u}&next=${current_request_path|u}">Upload Files</a>
-  <a class="fb-mkdir" data-icon-styles="{'width': 16, 'height': 16}" href="${url('filebrowser.views.mkdir')}?path=${path|u}&next=${current_request_path|u}">New Directory</a>
-</div>
-
-${dir.list_table_chooser(files, path_enc, current_request_path)}

+ 0 - 1
apps/filebrowser/src/filebrowser/urls.py

@@ -32,7 +32,6 @@ urlpatterns = patterns('filebrowser.views',
   url(r'^download=(?P<path>.*)$', 'download', name='download'),
   url(r'^status$', 'status', name='status'),
   url(r'^home_relative_view=(?P<path>.*)$', 'home_relative_view', name='home_relative_view'),
-  url(r'^chooser=(?P<path>.*)$', 'chooser', name='choose'),
   url(r'^edit=(?P<path>.*)$', 'edit', name='edit'),
 
   # POST operations

+ 2 - 24
apps/filebrowser/src/filebrowser/views.py

@@ -319,7 +319,7 @@ def parse_breadcrumbs(path):
     return breadcrumbs
 
 
-def listdir(request, path, chooser):
+def listdir(request, path):
     """
     Implements directory listing (or index).
 
@@ -368,10 +368,7 @@ def listdir(request, path, chooser):
         stats.insert(0, parent_stat)
 
     data['files'] = [_massage_stats(request, stat) for stat in stats]
-    if chooser:
-        return render('chooser.mako', request, data)
-    else:
-        return render('listdir.mako', request, data)
+    return render('listdir.mako', request, data)
 
 def _massage_page(page):
     return {
@@ -493,25 +490,6 @@ def listdir_paged(request, path):
     return render('listdir.mako', request, data)
 
 
-def chooser(request, path):
-    """
-    Returns the html to JFrame that will display a file prompt.
-
-    Dispatches viewing of a path to either index() or fileview(), depending on type.
-    """
-    # default_to_home is set in bootstrap.js
-    home_dir_path = request.user.get_home_directory()
-    if 'default_to_home' in request.GET and request.fs.isdir(home_dir_path):
-        return listdir(request, home_dir_path, True)
-
-    if request.fs.isdir(path):
-        return listdir(request, path, True)
-    elif request.fs.isfile(path):
-        return display(request, path)
-    else:
-        raise Http404(_("File not found: %(path)s") % {'path': escape(path)})
-
-
 def _massage_stats(request, stats):
     """
     Massage a stats record as returned by the filesystem implementation

+ 0 - 12
apps/filebrowser/src/filebrowser/views_test.py

@@ -509,18 +509,6 @@ class TestFileBrowserWithHadoop(object):
     assert_equal(['..', '.', '1'], [ f['name'] for f in listing ])
 
 
-  def test_chooser(self):
-    prefix = self.cluster.fs_prefix + '/test_chooser'
-    self.cluster.fs.mkdir(prefix)
-
-    # Note that the trailing slash is important. We ask for the root dir.
-    resp = self.c.get('/filebrowser/chooser=/?format=json')
-    # We should get a json response
-    dic = json.loads(resp.content)
-    assert_equal('/', dic['current_dir_path'])
-    assert_equal('/', dic['path'])
-
-
   def test_view_snappy_compressed(self):
     if not snappy_installed():
       raise SkipTest

+ 1 - 1
apps/oozie/src/oozie/templates/utils.inc.mako

@@ -360,7 +360,7 @@
         // check if it's a relative path
         var pathAddition = "";
         if ($.trim(inputElement.val()) != "") {
-          var checkPath = "/filebrowser/chooser=${ workflow.deployment_dir }" + "/" + inputElement.val();
+          var checkPath = "/filebrowser/view=${ workflow.deployment_dir }" + "/" + inputElement.val();
           $.getJSON(checkPath, function (data) {
             pathAddition = "${ workflow.deployment_dir }/";
             callFileChooser();

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

@@ -174,7 +174,7 @@
   Plugin.prototype.navigateTo = function (path) {
     var _parent = this;
     $(_parent.element).find('.filechooser-tree').html("<i style=\"font-size: 24px; color: #DDD\" class=\"fa fa-spinner fa-spin\"></i>");
-    $.getJSON("/filebrowser/chooser=" + path, function (data) {
+    $.getJSON("/filebrowser/view=" + path, function (data) {
       $(_parent.element).find('.filechooser-tree').empty();
 
       path = data.current_dir_path; // use real path.