Quellcode durchsuchen

HUE-4427 [metastore] Filepicker should allow directories when selecting external table

Enrico Berti vor 9 Jahren
Ursprung
Commit
f613b5c

+ 14 - 11
apps/beeswax/src/beeswax/templates/import_wizard_choose_file.mako

@@ -263,19 +263,22 @@ ${ assist.assistPanel() }
         e.preventDefault();
         var _destination = $(this).attr("data-filechooser-destination");
         var initialLoadValue = $('#id_load_data').val();
+        function handleChoice(filePath){
+          $("input[name='" + _destination + "']").val(filePath);
+          $("#chooseFile").modal("hide");
+          if (filePath.toLowerCase().indexOf('s3') === 0){
+            $('#id_load_data').val('EXTERNAL').trigger('change').find('option[value="IMPORT"]').attr('disabled', 'disabled');
+          }
+          else {
+            $('#id_load_data').val(initialLoadValue).trigger('change').find('option[value="IMPORT"]').removeAttr('disabled');
+          }
+        }
         $("#filechooser").jHueFileChooser({
           initialPath: $("input[name='" + _destination + "']").val(),
-          onFileChoose: function (filePath) {
-            $("input[name='" + _destination + "']").val(filePath);
-            $("#chooseFile").modal("hide");
-            if (filePath.toLowerCase().indexOf('s3://') === 0){
-              $('#id_load_data').val('EXTERNAL').trigger('change').find('option[value="IMPORT"]').attr('disabled', 'disabled');
-            }
-            else {
-              $('#id_load_data').val(initialLoadValue).trigger('change').find('option[value="IMPORT"]').removeAttr('disabled');
-            }
-          },
-          createFolder: $('#id_load_data').val() === 'EXTERNAL'
+          onFileChoose: handleChoice,
+          onFolderChoose: handleChoice,
+          createFolder: $('#id_load_data').val() === 'EXTERNAL',
+          selectFolder: $('#id_load_data').val() === 'EXTERNAL'
         });
         $("#chooseFile").modal("show");
       });

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

@@ -298,7 +298,7 @@
           }
           _createFolderBtn.appendTo(_actions);
           _showActions = true;
-          var _createFolderDetails = $("<form>").css("margin-top", "10px").addClass("well form-inline");
+          var _createFolderDetails = $("<form>").css({"margin-top": "10px", "position": "fixed"}).addClass("form-inline");
           _createFolderDetails.hide();
           var _folderName = $("<input>").attr("type", "text").attr("placeholder", _parent.options.labels.FOLDER_NAME).appendTo(_createFolderDetails);
           $("<span> </span>").appendTo(_createFolderDetails);