Browse Source

HUE-5424 [fb] Embed file list in responsive

Enrico Berti 9 năm trước cách đây
mục cha
commit
abbd723b4d

+ 5 - 2
apps/filebrowser/src/filebrowser/templates/listdir.mako

@@ -26,7 +26,9 @@ from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
 <%namespace name="dir" file="listdir_components.mako" />
 <%namespace name="fb_components" file="fb_components.mako" />
 
+%if not is_embeddable:
 ${ commonheader(None, 'filebrowser', user, request) | n,unicode }
+%endif
 ${ fb_components.menubar() }
 
 <style type="text/css">
@@ -35,7 +37,7 @@ ${ fb_components.menubar() }
   }
 </style>
 
-<div class="container-fluid">
+<div id="filebrowser" class="container-fluid">
 
   <div class="card card-small">
     <div class="actionbar">
@@ -185,5 +187,6 @@ ${ fb_components.menubar() }
 
 </div>
 
-
+%if not is_embeddable:
 ${ commonfooter(request, messages) | n,unicode }
+%endif

+ 1 - 1
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -1846,7 +1846,7 @@ from django.utils.translation import ugettext as _
     };
 
     var viewModel = new FileBrowserModel([], null, [], "/");
-    ko.applyBindings(viewModel);
+    ko.applyBindings(viewModel, $('#filebrowser')[0]);
 
     $(document).ready(function () {
       $('.historyLink').on('click', function (e) {

+ 3 - 1
apps/filebrowser/src/filebrowser/views.py

@@ -352,6 +352,7 @@ def listdir(request, path, chooser):
         'show_upload': (request.REQUEST.get('show_upload') == 'false' and (False,) or (True,))[0],
         'show_download_button': SHOW_DOWNLOAD_BUTTON.get(),
         'show_upload_button': SHOW_UPLOAD_BUTTON.get(),
+        'is_embeddable': request.GET.get('is_embeddable', False),
     }
 
     stats = request.fs.listdir_stats(path)
@@ -485,7 +486,8 @@ def listdir_paged(request, path):
         'is_sentry_managed': request.fs.is_sentry_managed(path),
         'apps': appmanager.get_apps_dict(request.user).keys(),
         'show_download_button': SHOW_DOWNLOAD_BUTTON.get(),
-        'show_upload_button': SHOW_UPLOAD_BUTTON.get()
+        'show_upload_button': SHOW_UPLOAD_BUTTON.get(),
+        'is_embeddable': request.GET.get('is_embeddable', False),
     }
     return render('listdir.mako', request, data)
 

+ 9 - 2
desktop/core/src/desktop/templates/responsive.mako

@@ -214,7 +214,7 @@ ${ hueIcons.symbols() }
         <li><a href="javascript: { ko.dataFor($('.page-content')[0]).currentApp('metastore') }">Metastore</a></li>
         <li><a href="javascript: void(0);">Indexes</a></li>
         <li><a href="javascript: { ko.dataFor($('.page-content')[0]).currentApp('jobbrowser') }">Job Browser</a></li>
-        <li><a href="javascript: void(0);">File Browser</a></li>
+        <li><a href="javascript: { ko.dataFor($('.page-content')[0]).currentApp('filebrowser') }">File Browser</a></li>
         <li><a href="javascript: void(0);">HBase</a></li>
         <li><a href="javascript: void(0);">Security</a></li>
       </ul>
@@ -263,6 +263,7 @@ ${ hueIcons.symbols() }
       <div id="embeddable_search" class="embeddable"></div>
       <div id="embeddable_oozie_wf" class="embeddable"></div>
       <div id="embeddable_jobbrowser" class="embeddable"></div>
+      <div id="embeddable_filebrowser" class="embeddable"></div>
     </div>
 
     <div id="rightResizer" class="resizer" data-bind="visible: rightAssistVisible(), splitFlexDraggable : {
@@ -307,9 +308,14 @@ ${ hueIcons.symbols() }
 <script src="${ static('desktop/js/hue.utils.js') }"></script>
 <script src="${ static('desktop/ext/js/bootstrap.min.js') }"></script>
 <script src="${ static('desktop/ext/js/bootstrap-better-typeahead.min.js') }"></script>
+<script src="${ static('desktop/ext/js/fileuploader.js') }"></script>
+<script src="${ static('desktop/ext/js/filesize.min.js') }"></script>
 <script src="${ static('desktop/ext/js/moment-with-locales.min.js') }"></script>
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery.total-storage.min.js') }"></script>
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery.cookie.js') }"></script>
+<script src="${ static('desktop/ext/js/jquery/plugins/jquery.dataTables.1.8.2.min.js') }"></script>
+<script src="${ static('desktop/ext/js/jquery/plugins/jquery.form.js') }"></script>
+<script src="${ static('desktop/js/jquery.datatables.sorting.js') }"></script>
 
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery.basictable.min.js') }"></script>
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery-ui-1.10.4.custom.min.js') }"></script>
@@ -372,7 +378,8 @@ ${ assist.assistPanel() }
           metastore: '/metastore/tables/?is_embeddable=true',
           search: '/search/embeddable/new_search',
           oozie_wf: '/oozie/editor/workflow/new/?is_embeddable=true',
-          jobbrowser: '/jobbrowser/apps?is_embeddable=true'
+          jobbrowser: '/jobbrowser/apps?is_embeddable=true',
+          filebrowser: '/filebrowser/?is_embeddable=true'
         };
 
         self.embeddable_cache = {};