소스 검색

HUE-2296 [fb] The pagination is not working

Fixed hashchange and load on missing path
Fixed problem with Dropzone double init on path change
Fixed Dropzone overlay css
Enrico Berti 11 년 전
부모
커밋
3c5d9a1
2개의 변경된 파일45개의 추가작업 그리고 19개의 파일을 삭제
  1. 44 18
      apps/filebrowser/src/filebrowser/templates/listdir_components.mako
  2. 1 1
      desktop/core/static/css/hue3.css

+ 44 - 18
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -1130,7 +1130,13 @@ from django.utils.translation import ugettext as _
           }
         });
 
+        var _dropzone;
         $(document).on('currPathLoaded', function (e, ops) {
+          try {
+            _dropzone.destroy();
+          }
+          catch (e) {
+          }
           var options = {
             url: '/filebrowser/upload/file?dest=' + ops.path,
             paramName: 'hdfs_file',
@@ -1163,7 +1169,7 @@ from django.utils.translation import ugettext as _
               $.jHueNotify.info("${_('Upload has been canceled')}");
             }
           };
-          var dz = new Dropzone(document.body, options);
+          _dropzone = new Dropzone(document.body, options);
         });
       }
 
@@ -1373,13 +1379,29 @@ from django.utils.translation import ugettext as _
       $("*[rel='tooltip']").tooltip({ placement:"bottom" });
 
       if (location.hash != null && location.hash.length > 1) {
-        var targetPath = "${url('filebrowser.views.view', path=urlencode('/'))}" + stripHashes(location.hash.substring(2));
-
-        viewModel.targetPath(targetPath);
-
-        if (targetPath.indexOf("!!") > -1){
-          viewModel.targetPageNum(targetPath.substring(targetPath.indexOf("!!")+2)*1)
-          targetPath = targetPath.substring(0, targetPath.indexOf("!!"));
+        var targetPath = "";
+        var hash = window.location.hash.substring(1);
+        if (hash != null && hash != "") {
+          targetPath = "${url('filebrowser.views.view', path=urlencode('/'))}";
+          if (hash.indexOf("!!") != 0) {
+            targetPath += stripHashes(hash.substring(1));
+          }
+          else {
+            targetPath = viewModel.targetPath() + hash;
+          }
+          if (targetPath.indexOf("!!") > -1) {
+            viewModel.targetPageNum(targetPath.substring(targetPath.indexOf("!!") + 2) * 1)
+            targetPath = targetPath.substring(0, targetPath.indexOf("!!"));
+          }
+          else {
+            viewModel.targetPageNum(1)
+          }
+        }
+        if (window.location.href.indexOf("#") == -1) {
+          viewModel.targetPageNum(1);
+          targetPath = "${current_request_path}";
+        }
+        if (targetPath != "") {
           viewModel.targetPath(targetPath);
         }
       }
@@ -1429,23 +1451,27 @@ from django.utils.translation import ugettext as _
 
       $(window).bind("hashchange", function () {
         var targetPath = "";
-        var hash = location.hash.substring(1);
-
+        var hash = window.location.hash.substring(1);
         if (hash != null && hash != "") {
-          targetPath = "${url('filebrowser.views.view', path=urlencode('/'))}" + stripHashes(hash.substring(1));
-          if (targetPath.indexOf("!!") > -1){
-            viewModel.targetPageNum(targetPath.substring(targetPath.indexOf("!!")+2)*1)
+          targetPath = "${url('filebrowser.views.view', path=urlencode('/'))}";
+          if (hash.indexOf("!!") != 0) {
+            targetPath += stripHashes(hash.substring(1));
+          }
+          else {
+            targetPath = viewModel.targetPath() + hash;
+          }
+          if (targetPath.indexOf("!!") > -1) {
+            viewModel.targetPageNum(targetPath.substring(targetPath.indexOf("!!") + 2) * 1)
             targetPath = targetPath.substring(0, targetPath.indexOf("!!"));
-          } else {
+          }
+          else {
             viewModel.targetPageNum(1)
           }
         }
-
-        if (location.href.indexOf("#") == -1) {
-          viewModel.targetPageNum(1)
+        if (window.location.href.indexOf("#") == -1) {
+          viewModel.targetPageNum(1);
           targetPath = "${current_request_path}";
         }
-
         if (targetPath != "") {
           viewModel.targetPath(targetPath);
           viewModel.retrieveData();

+ 1 - 1
desktop/core/static/css/hue3.css

@@ -1830,7 +1830,7 @@ input.no-margin {
   display: none;
   height: 100%;
   opacity: .5;
-  position: absolute;
+  position: fixed;
   width: 100%;
   top:0;
   z-index: 10000;